失败:生成失败,出现异常。
哪里出了问题:
任务":shared_preferences:compileDebugJavaWithJavac"的执行失败。找不到tools.jar。请检查C:\Program Files\Java\jre1.8.0_261是否包含有效的JDK安装。
我尝试了什么:
使用--stack trace选项运行以获取堆栈跟踪。
使用--info或--debug选项运行以获得更多日志输出。
使用--scan运行以获得完整的见解。
获取更多帮助,请访问https://help.gradle.org
- 列表项
BUILD FAILED in 1m37s异常:Gradle任务组装调试失败,退出代码为1
当我运行flutter doctor -v
时
G:projectname>flutter doctor -v
[√] Flutter (Channel beta, 1.22.1, on Microsoft Windows [Version 10.0.19041.572], locale en-US)
• Flutter version 1.22.1 at C:src_vscodeflutter
• Framework revision f30b7f4db9 (12 days ago), 2020-10-08 10:06:30 -0700
• Engine revision 75bef9f6c8
• Dart version 2.10.1
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
• Android SDK at C:UsersWaqas HameedAppDataLocalAndroidsdk
• Platform android-30, build-tools 30.0.1
• Java binary at: C:Program FilesJavajre1.8.0_261binjava
• Java version Java(TM) SE Runtime Environment (build 1.8.0_261-b12)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:Program Files (x86)GoogleChromeApplicationchrome.exe
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
[√] VS Code (version 1.50.1)
• VS Code at C:UsersWaqas HameedAppDataLocalProgramsMicrosoft VS Code
• Flutter extension version 3.15.1
[√] Connected device (4 available)
• AOSP on IA Emulator (mobile) • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)
• Web Server (web) • web-server • web-javascript • Flutter Tools
• Chrome (web) • chrome • web-javascript • Google Chrome 86.0.4240.75
• Edge (web) • edge • web-javascript • Microsoft Edge 86.0.622.38
! Doctor found issues in 1 category.
您可以尝试以下步骤:
- flutter pub cache repair
- cd <YOUR APP FOLDER>
- flutter clean