skip to Main Content

I wanted to test my flutter app in phone. So i tried build an apk. I ran this in app files:

flutter build apk --split-per-abi

results:

 FAILURE: Build failed with an exception.

* Where:
Build file 'C:UsersCan AhmetStudioProjectsmyappmyappandroidappbuild.gradle' line: 26

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not open cp_dsl generic class cache for script 'C:SRCflutterpackagesflutter_toolsgradleflutter.gradle' (C:UsersCan Ahmet.gradlecaches7.4scripts926y60l3pifaoznpot8d19f2t).
   > BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 63

* 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

BU�LD FAILED in 14s
Running Gradle task 'assembleRelease'...                           17,5s
Gradle task assembleRelease failed with exit code 1

How can i solve that?

I tried run with --stacktrace option to get the stack trace.
result:

Could not find an option named "stacktrace".


Run 'flutter -h' (or 'flutter <command> -h') for available flutter commands and options.

I tried run with --debug option to get more log output.
result:

'build' is not recognized as an internal or external command,
operable program or batch file.

Did i wrong write?

Run images

2

Answers


  1. Chosen as BEST ANSWER

    I had Java 19 and gradle 6.7. Those are not compatible. You can learn Compatibility Matrix here

    I used java 19 and gradle 7.6. Those are compatible. That is worked. But now i have new problem Flutter Error (while build apk) : FAILURE: Build failed with an exception. > Could not resolve all files for configuration ':classpath'


  2. Try the following commands:

    1. flutter clean

    2. flutter pub get

    3. flutter build apk --release (for release build apk)

      flutter build apk --debug (for debug apk)

    Still, if the problem is not resolved try with a lower version of Gradle.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search