NoSuchMethodError: CompilerOptions.versionToJdkLevel with Android Gradle Plugin 2.3.0-alpha1
Hello. I have a problem with migration to greendao3. I follow guide http://greenrobot.org/greendao/documentation/updating-to-greendao-3-and-annotations/
New classes generated successfully. Gradle greendao plugin added and applied. But while compiling, i get error:
Caused by: java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.impl.CompilerOptions.versionToJdkLevel(Ljava/lang/Object;)J
at org.eclipse.jdt.core.dom.ASTConverter.<init>(ASTConverter.java:91)
at org.eclipse.jdt.core.dom.CompilationUnitResolver.convert(CompilationUnitResolver.java:285)
at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1216)
at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:812)
at org.greenrobot.greendao.codemodifier.EntityClassParser.parse(EntityClassParser.kt:25)
I tried clean project, remove .gradle dir, nothing helps. Full stacktrace: http://pastebin.com/shPg8Wi7
Android studio 2.3. Gradle: com.android.tools.build:gradle:2.3.0-alpha1. Greendao 3.2.0.
What can be wrong? Thanks :)
Same issue with me, using gradle 2.2.2 is fine, upgrade to 2.3.0-aplha1 have this issue.
Yes, with 2.2.2 is ok. Downgraded for now
Will keep this open for reference if this still is broken once the final 2.3.0 version of the Android Gradle Plugin is released. alpha is rather early and things are expected to be broken. -ut
Just for notify: gradle:2.3.0-alpha2 + greendao3.2.1, same problem.
the same also happen gradle:2.3.0-aplha3 and gradle:2.3.0-beta1
It seems to work with gradle:2.3.0-beta2. My app did not crash when creating the DB :)
@NeoSyder Does that include Gradle 3.3 in your set up?
Yep exactly, I use Gradle 3.3
I'm having this problem with:
- gradle 3.3
classpath 'com.android.tools.build:gradle:2.3.0-beta2'classpath 'org.greenrobot:greendao-gradle-plugin:3.2.1'compile 'org.greenrobot:greendao:3.2.0'
Testing this now. Will update with results.
Working configurations
- Android Studio 2.2.3 (current stable release), Android Plugin 2.2.3 (current stable), Gradle 3.3 (current stable)
- Android Studio 2.3 Beta 2, Android Plugin 2.3.0-beta2, Gradle 3.3
Broken configuations
- none so far
-ut
@caarmen I saw you already removed it: but make sure to move the buildscript block to the very top of your file. Also, try to include the greenDAO plugin in the root buildscript block at the same level as the Android plugin.
Update: can reproduce error if plugin is not defined at the same level as the Android Gradle plugin. This is likely a similar issue as #442.
Update: the Android Gradle Plugin has updated to org.eclipse.jdt.core.compiler:ecj:4.6.1 from 4.5.1. This has changed the signature of CompilerOptions.versionToJdkLevel(Object) to CompilerOptions.versionToJdkLevel(String). The greenDAO Gradle plugin currently uses org.eclipse.scout.sdk.deps:org.eclipse.jdt.core:3.11.0.v20150602-1242 which excpects the old signature.
-ut
tested on 2.3 beta 3 , still same issue
Sorry for the delay!
Moving the greendao plugin classpath to the root build.gradle file fixed this issue! Thanks :)
I didn't have to change the position of the buildscript block in my app/build.gradle file.
解决方法就是:buildscript 放到application下
I have fixed this issue. I put this classpath 'org.greenrobot:greendao-gradle-plugin:3.2.1' in the application's buildscript not the top. Then making this classpath to the top and resolved it.
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.1' with stable Android studio 2.3 is not working. Same error.
Move "lasspath 'org.greenrobot:greendao-gradle-plugin:3.2.1'" to the root build.gradle file. I have it worked with Android Studio 2.3.
I also confirm i fixed the issue in Android Studio 2.3 by moving the
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.1' from app.gradle file to project build.gradle file
It does work when moving the classpath to the root build.gradle file. However, I have a multi-project setup where not all of the subprojects actually use greenDAO. Is there currently an option to get the build working without moving the classpath?
@PattaFeuFeu not sure we will have to wait for @greenrobot-team to provide a fix