I have a multi module Android Compose project. One module is an android app, others are android libraries or kotlin libraries. I'm running AS Artic Fox 2020.3.1 Beta 5 on MacOS 11.4 Big Sur.
After a library upgrade (probably AGP to use compose, I don't remember when exactly) Android Studio started to show syntax errors everywhere, both in .kts and .kt files.
Compilation and execution are working fine, only those weird JDK errors are displayed.
Here are some examples :
in a .kt file from a kotlin library module, in a .kts file from the buildSrc module
It seems that there is an error with the JDK somewhere, but I don't understand how to fix it.
I Googled/StackOverflowed before posting here and I already tried :
to check the JDK used Project Structure > SDK Location > Gradle. It is using the Embedded JDK 11.0.10
to reinstall AS using Jetbrains Toolbox
to invalidate cache and restart
to clone my project again
to delete ~/.gradle
But none of those actions helped...
Thanks in advance !
Update 22/07
I tried to create a new empty Compose project with .kts support, but no luck, everything is in red
Because of a bug preventing to update, I updated manually to RC_1. Here is my current setup.
I tried to change from Embedded JDK to a separately installed OpenJDK 11 and reimport but not luck (#alexey-belkov suggestion)
I checked the logs but found nothing obvious (#andy suggestion)
ℹ️ Finally I tried to create a new empty Android project with only .gradle support, and no errors ! Could it be a kotlin script plugin problem ?
I have followed the instructions in https://github.com/mbats/eclipse-buildroot-bundle/wiki/Tutorial-:-How-to-activate-and-install-the-Buildroot-Eclipse-plugin-%3F for installing the plugin.
Buildroot's server for eclipse plugins (https://buildroot.org/downloads/eclipse/) does'nt contain plugin for eclipse MARS version (v4.5).
I tried to install the 'Luna' version (v4.4) plugin but I got my toolchain list corrupted.
I tried starting-up eclipse with the -clean flag in the 'eclipse.ini' file but it didnt help either.
How can I make eclipse "register" buildroot plugin for eclipse versions higher than 4.4 ?
The plugin supports at most Eclipse Luna at the moment. Work is on-going to support higher versions.
Am working on a system built in Gradle 2.2 with groovy plugin 2.3.7 !
My problem is my IDEA ( Intellij 14 ) didn't recognise ConfigSlurper groovy class when i tried to define new object of this class.
Tried to recompile the groovy plugin with no result !
Any help or tips would be appreciated !
Edited :
I figured it out and it was groovy sdk version that wasn't configured!
This can also happen if you upgrade your gradle and IntelliJ doesn't seem to realize it.
Checking it out again from source control in a new directory and reopening it seemed to make it happier.
I'm experiencing a very strange problem when compiling a Groovy project with IntelliJ IDEA 13.1.1 (Mac OSX).
After I've annotated some groovy classes with #CompileStatic, as soon as I build the project the IntelliJ compiler hung on the "instruction selection" stage and starts consuming all CPUs resources (I can see the CPUs running above 700%).
The compilation never complete. Building using an external tool (Gradle) it compiles without any problem.
Any clue what cloud be the problem. Is the a workaround?
Solved by installing the latest IntelliJ IDEA 13.1.2 RC build 135.689
http://confluence.jetbrains.com/display/IDEADEV/IDEA+13.1+EAP
I'm compiling a project that works OK in Eclipse, and builds fine with ant, but in IntelliJ IDEA gives:
Internal groovyc error: code 1
How can I resolve this? Other error messages include:
1:35:46 PM Unknown Natures Detected
Imported projects contain unknown natures:
org.eclipse.jdt.groovy.core.groovyNature
Some settings may be lost after import.
1:43:55 PM Compilation completed with 1 error and 7 warnings in 20 sec
Groovyc: Cannot compile Groovy files: no Groovy library is defined for module
Groovy itself is installed on Linux. Adding it as a groovy compiler in settings does not affect the behavior:
> groovy --version
Groovy Version: 1.7.4 JVM: 1.6.0_24
Apparently you tried to import an Eclipse project into IDEA, and that isn't good enough. (Groovy) Eclipse comes with its own version of Groovy, whereas in IDEA, you have to add groovy-all-1.7.4.jar (or whatever version you want to use) as a compile dependency.
You have to add JAXB dependencies if you are using Groovy 2.5.3 + Java 11 (also check out Java 11 related change). Groovy comes with extra JAXB Jars so we can add them. Open 'Project Structure' dialog, then select 'Dependencies' tab and add the dependencies
Changing the project SDK from Java 15 to Java 8 seemed to have magically fixed the same problem on my machine.
Steps:
Go to File > Project structure... (may differ on Mac/Linux).
Under Project Settings, select Project.
In Project SDK: dropdown, choose a different version of the JDK installed.
Click Apply & OK at the bottom of the dialog.
** Rerun your program.
This worked for me!!
Read the log before the "Internal groovyc error: code 1", then it should show you a groovy version mismatch. Change your groovy version from the dependency list as per the log.
Ex. compile 'org.codehaus.groovy:groovy-all:2.4.11'
Move the Groovy dependency in the module settings to the top right after JDK.
I could make it work just by reestart intellij and invalidate the caches.
It can be found (for intelliJ 2018.1):
File -> Invalidate Caches/restart -> Invalidate and Restart
I found this solution which worked totally for me. You can use this link for fixing this problem
resolving-groovyc-internal-groovyc-error-code-1
I had to reinstall groovy SDK and it started working.
i was use wrong SDK ,please cheak your SDK version