我在Flutter应用中使用了Cloud Firestore,现在出现此错误
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
这是我的gradle.build文件
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 27
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.datacollectorsecond"
minSdkVersion 21
targetSdkVersion 27
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.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
}
}
}
flutter {
source '../..'
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
configurations.all {
resolutionStrategy {
force 'com.google.android.gms:play-services-places:11.8.0'
force 'com.google.android.gms:play-services-location:11.8.0'
}
}
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation ('com.google.android.gms:play-services-places:11.8.0') {
force = true
}
implementation ('com.google.android.gms:play-services-location:11.8.0') {
force = true
}
}
我收到此错误: 注意:/Users/apple/Desktop/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core-0.2.5+1/android/src/main/java/io/flutter/plugins/firebase/core/ FirebaseCorePlugin.java使用未经检查或不安全的操作。 注意:使用-Xlint:unchecked重新编译以获取详细信息。 注意:某些输入文件使用未经检查或不安全的操作。 注意:重新编译-Xlint:unchecked以获得详细信息。
失败:构建失败,并出现异常。
java.lang.RuntimeException:com.android.builder.dexing.DexArchiveMergerException:无法合并dex 一个星期前它工作正常,现在显示错误,但是当我删除cloud_firesotore时,它开始工作