我发现了一个错误:
Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/android/libraries/places/internal/dh;我试着打扫和重建这个项目,但没有成功。任何帮助都将不胜感激。
Android Studio 3.0.1
项目级build.gradle
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
mavenCentral()
google()
jcenter()
maven { url 'https://jitpack.io'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}App级build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "in.mycrony"
minSdkVersion 16
targetSdkVersion 27
versionCode 86
versionName "2.86"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.github.barteksc:android-pdf-viewer:2.0.3'
implementation 'com.google.android.libraries.places:places-compat:1.1.0'
implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.4.1'
implementation 'id.zelory:compressor:2.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.squareup.picasso:picasso:2.5.1'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.4.+'
implementation 'com.squareup.okhttp3:okhttp:3.7.0'
implementation 'de.hdodenhof:circleimageview:3.0.0'
implementation 'com.google.firebase:firebase-database:17.0.0'
implementation 'com.google.firebase:firebase-auth:17.0.0'
implementation 'com.google.android.libraries.places:places-compat:1.1.0'
implementation 'com.google.firebase:firebase-messaging:18.0.0'
implementation 'com.google.android.libraries.places:places:1.1.0'
implementation project(':library')
}
apply plugin: 'com.google.gms.google-services'库级build.gradle
apply plugin: 'com.android.library'
apply from: "quality.gradle"
group = 'com.github.eggheadgames'
android {
compileSdkVersion 27
buildToolsVersion '26.0.2'
defaultConfig {
minSdkVersion 16
targetSdkVersion 27
versionCode 13
versionName "1.5.2"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
warningsAsErrors true
disable 'OldTargetApi'
disable 'GradleDependency'
}
}
dependencies {
testImplementation 'org.mockito:mockito-core:1.10.19'
testImplementation 'org.json:json:20160212'
implementation 'com.android.support:appcompat-v7:27.1.1'
}我已经试过了所有的答案,但我无法解决这个错误。
发布于 2019-06-11 11:01:43
原因: com.android.dex.DexException:多个dex文件定义Lcom/google
你应该用其中之一
implementation 'com.google.android.libraries.places:places-compat:1.1.0'
implementation 'com.google.android.libraries.places:places:1.1.0' //Remove然后是Clean-Rebuild-Run.
发布于 2019-06-11 13:08:18
最后,我对Place使用了实现'com.google.android.libraries.places:places:1.0.0‘,并对Picker使用了相同的旧的'com.google.android.gms:play-services’依赖。
https://stackoverflow.com/questions/56541948
复制相似问题