简体   繁体   中英

Could not initialize class org.codehaus.groovy.reflection.ReflectionCache #Ubuntu #flutter #androidStudio

I'm unable to run my first flutter project, running flutter run throws

Could not initialize class org.codehaus.groovy.reflection.ReflectionCache

[ FAILURE: Build failed with an exception.

  • What went wrong: Could not initialize class org.codehaus.groovy.reflection.ReflectionCache

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 5s Exception: Gradle task assembleDebug failed with exit code 1 ]

I use Ubuntu operating system and Android Studio as my IDE. please help thanks in advance

Firstly your JDK version should be between 8 and 14.

I solve this problem by going in the file my_projet/android/gradle.properties and put the command org.gradle.java.home=/path/to/jdk your version of the jdk should be between 8 and 14, if jour jdk version is 14 it will not pass.

Because i am on Ubuntu OS i have written eg: org.gradle.java.home=/usr/lib/jvm/java-11-openjdk-amd64

and after i run my project all works fine

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM