android - Flutter build 第一次报错:Could not open settings remapped class cache for 7yvt6la2007dno98lt3rzbguf
问题描述
我刚刚下载了 Flutter,并尝试使用 Google 提供的第一个默认代码来学习模拟器。但它根本不运行!
我安装了飞镖和颤振插件。我也改变了 jcenter() 和 google() 的顺序
像这样:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
jcenter()
google()
}
}
错误是:
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
Could not open settings remapped class cache for 7yvt6la2007dno98lt3rzbguf (/Users/[myname]/.gradle/caches/5.6.2/scripts-remapped/settings_7iv4l88jiyzeatj2wku74hwcv/7yvt6la2007dno98lt3rzbguf/settings8410a2d21ed2f87c8a0398566330ee52).
> Could not open settings generic class cache for settings file '/Users/[myname]/AndroidStudioProjects/test_app/android/settings.gradle' (/Users/[myname]/.gradle/caches/5.6.2/scripts/7yvt6la2007dno98lt3rzbguf/settings/settings8410a2d21ed2f87c8a0398566330ee52).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 57
* 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 568ms
Finished with error: Gradle task assembleDebug failed with exit code 1
解决方案
如果您使用的是 Windows 10,请将JAVA_HOME
环境变量设置为 JRE for Android Studio。例如:
C:\Program Files\Android\Android Studio\jre
推荐阅读
- c - 如何实现 SHA512/256 OpenSSL?
- mysql - 从其他表中选择用户名,如果为 NULL
- android - androidx.lifecycle.DefaultLifecycleObserver 是否有可靠的方法来检测应用程序退出事件?
- php - 添加自定义块moodle时显示[[pluginname]]
- javascript - 如何让我的 api 调用调用不同的文件?
- git - GitHub API - 最新的分支提交已被推送到 master 中?
- python - 有没有办法逐步绘制极地热图?
- r - 当属性单独传递和在数据帧中传递时,cor 函数给出不同的值
- python - 无法将列转换为日期时间
- python - Python 命名空间包