[英]Flutter Android Build APK Error lintvitalrelease
I try to generate the apk from my flutter app.我尝试从我的颤振应用程序生成 apk。 But every time i become this error code
但每次我变成这个错误代码
FAILURE: Build failed with an exception.
FAILURE:构建失败,出现异常。
What went wrong: Could not determine the dependencies of task ':app:lintVitalRelease'.
出了什么问题:无法确定任务“:app:lintVitalRelease”的依赖关系。 Could not resolve all artifacts for configuration ':app:debugAndroidTestCompileClasspath'.
无法解析配置“:app:debugAndroidTestCompileClasspath”的所有工件。 Could not find androidx.test:runner:1.2.1.
找不到 androidx.test:runner:1.2.1。 Required by: project :app Could not find androidx.test.espresso:espresso-core:3.2.1.
要求:项目:app 找不到 androidx.test.espresso:espresso-core:3.2.1。 Required by: project :app
需要:项目:app
Try: Run with --stacktrace option to get the stack trace.
尝试:使用 --stacktrace 选项运行以获取堆栈跟踪。 Run with --info or --debug option to get more log output.
使用 --info 或 --debug 选项运行以获得更多日志输出。 Run with --scan to get full insights.
使用 --scan 运行以获得完整的见解。
Get more help at https://help.gradle.org
在https://help.gradle.org获取更多帮助
this is the build.gradle file in /app这是 /app 中的 build.gradle 文件
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.3'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "26.1.0"
}
}
}
}
and this is the build.gradle in /app/src/这是 /app/src/ 中的 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 = '0.0.1'
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 29
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "de.***.***"
minSdkVersion 21
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.release
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
flutter {
source '../..'
}
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.1'
}
apply plugin: 'com.google.gms.google-services'
i find nothing on github or stackoverflow.我在 github 或 stackoverflow 上什么也没找到。 have anyone a idea ?
有人有什么想法吗?
尝试将您的项目迁移到 androidX,如果这不起作用,请尝试将您的 flutter 版本降级到 1.9,我遇到了同样的错误,在我降级我的 flutter 版本后,它起作用了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.