![](/img/trans.png)
[英]FAILURE: Build failed with an exception. I cant build my flutter app :'(
[英]I cant build apk flutter app. Error: FAILURE: Build failed with an exception
我想在手機上測試我的 flutter 應用程序。 所以我嘗試構建一個 apk。 我在應用程序文件中運行了這個:
flutter build apk --split-per-abi
結果:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\Can Ahmet\StudioProjects\myapp\myapp\android\app\build.gradle' line: 26
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not open cp_dsl generic class cache for script 'C:\SRC\flutter\packages\flutter_tools\gradle\flutter.gradle' (C:\Users\Can Ahmet\.gradle\caches\7.4\scripts\926y60l3pifaoznpot8d19f2t).
> 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
我該如何解決?
我嘗試使用 --stacktrace 選項運行以獲取堆棧跟蹤。 結果:
Could not find an option named "stacktrace".
Run 'flutter -h' (or 'flutter <command> -h') for available flutter commands and options.
我嘗試使用 --debug 選項運行以獲得更多日志輸出。 結果:
'build' is not recognized as an internal or external command,
operable program or batch file.
我寫錯了嗎? 運行圖像
試試這個 flutter clean, flutter packages get, flutter build apk --release 如果這個步驟不起作用你可以嘗試使用較低版本的 gradle。
我有 Java 19 和 gradle 6.7。 那些不兼容。 您可以在此處學習兼容性矩陣
我使用 java 19 和 gradle 7.6。 那些是兼容的。 那是有效的。 但是現在我遇到了新問題Flutter Error (while build apk): FAILURE: Build failed with an exception。 > 無法解析配置“:classpath”的所有文件
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.