遇到的几个flutter开发环境问题

学习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

image.png

解决办法

JDK的版本不合适。我升级到了JDK19,然后又退回到了JDK11

报错2

报错内容

Cannot resolve symbol 'Properties'

image.png

解决办法

去项目路径下Android 目录下 ./gradew clean一下
然后再去project structure 下设置下SDK
image.png

报错3

报错内容

Could not locate aapt. Please ensure you have the Android buildtools installed

解决办法

去SDK Manger里去更新下SDK或者重新下载下SDK

猜你喜欢

转载自blog.csdn.net/yikezhuixun/article/details/129334631
今日推荐