【发布时间】:2020-07-20 08:57:29
【问题描述】:
我有一个正在开发的应用程序,当我打开 build.gradle 文件时
出现了几个错误
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.shopapp"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
控制台输出:
在调试模式下在 IA 模拟器上的 AOSP 上启动 lib\main.dart... 正在运行 Gradle 任务 'assembleDebug'...
FAILURE:构建失败并出现异常。
出了什么问题:任务 ':app:stripDebugDebugSymbols' 执行失败。
没有与请求的版本 20.0.5594570 匹配的 NDK 版本。本地可用版本:21.0.6113669
尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。运行 --scan 以获得完整的见解。
通过https://help.gradle.org获得更多帮助
BUILD FAILED in 1s Finished with error: Gradle task assembleDebug 退出代码 1 失败
logcat 中也有一条消息
Please configure Android SDK
我寻找解决方案,但没有找到解决方案
我只是需要帮助,不知道我是否违反了网站的法律,因为我不会说流利的英语
【问题讨论】: