学习Flutter,本来好好的开发环境,想导入一个开源项目,一堆错误,改了一堆东西,弄坏了开发环境,报了一堆错误,现在弄好了,记录下刚解决的几个,防止后面再来一边。之前解决的没记录。
报错1
报错内容
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'android'.
Could not open cp_proj generic class cache for build file 'D:\WORK\myLearningWork\development\untitled4\android\build.gradle' (C:\Users\YUAN.gradle\caches\7.5\scripts\agf2mvwbt4y5kvskau5h632qq).
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
BUILD FAILED in 1s
Exception: Gradle task assembleDebug failed with exit code 1
解决办法
JDK的版本不合适。我升级到了JDK19,然后又退回到了JDK11
报错2
报错内容
Cannot resolve symbol 'Properties'
解决办法
去项目路径下Android 目录下 ./gradew clean一下
然后再去project structure 下设置下SDK
报错3
报错内容
Could not locate aapt. Please ensure you have the Android buildtools installed
解决办法
去SDK Manger里去更新下SDK或者重新下载下SDK
版权声明:本文为yikezhuixun原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。