D8:程序类型已存在:androidx.work.ArrayCreatingInputMerger
失败:构建失败,并出现异常。
in gradle.properties
```android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536M```
in 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.xyz"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
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.debug
minifyEnabled true
useProguard true
// shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
flutter {
source '../..'
}
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'com.google.firebase:firebase-firestore:18.0.0'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.6'
}
apply plugin: 'com.google.gms.google-services'```
8:程序类型已存在:androidx.work.ArrayCreatingInputMerger
失败:构建失败,并出现异常。
出了什么问题: 任务':app:transformClassesWithMultidexlistForDebug'的执行失败。
com.android.build.api.transform.TransformException:生成主dex列表时出错: 合并dex归档文件时出错: 在https://developer.android.com/studio/build/dependencies#duplicate_classes了解如何解决该问题。 程序类型已经存在:androidx.work.ArrayCreatingInputMerger
尝试: 使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。使用--scan运行以获取完整的见解。
4秒内失败
Gradle失败可能是由于此Flutter应用程序中的AndroidX不兼容所致。 有关该问题及其解决方法的更多信息,请参见goo.gl/CP92wY。
Gradle任务assembleDebug失败,退出代码为1