Flutter Getting Error While Running: java.lang.IllegalAccessError

1,927

You can run your project by opening Android module in Android studio. Go to

Tools->Flutter->Open for Editing in Android Studio

Why are you facing this error?

Gradle 6 is not fully compatible with java 16. Use Java 11 will resolve the issue. Download JDK 11 64 bit version and uninstall the current version of java.

You can check your java version by running java -version in command line interface.

Note: Java 11 is ideal at this date (10 june,2021) so far.

Share:
1,927
Enes Özdemir
Author by

Enes Özdemir

Updated on December 22, 2022

Comments

  • Enes Özdemir
    Enes Özdemir over 1 year

    I am trying to install flutter to my new computer. Everything seems fine in flutter doctor but when i run my app I get an error.

    Execution failed for task ':app:compileDebugJavaWithJavac'.
    > java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module @0x16545f8f) cannot access class com.sun.tools.javac.code.Symbol$TypeSymbol (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module @0x16545f8f
    

    How can i fix this . Please help

  • Daniel Baltazar Schneider
    Daniel Baltazar Schneider over 2 years
    That really was the problem, thank you very much