Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.> com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
刚刚从2.3.3版本更新Android studio 3.0.1后,我面临与DexMergerException相关的问题。
其他人也发布了与此相关的问题。但在这个问题中,我想分析堆栈跟踪以找到相关的解决方案(因为我在这里是新手......)。
我无法解决它。
这是我的build.gradle(模块:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.aimnatvtz.aimatv"
manifestPlaceholders = [onesignal_app_id: "MY_ONESIGNAL_APP_ID",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "226589149887"]
minSdkVersion 16
targetSdkVersion 27
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
google()
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.0'
}
}
}
}
implementation 'com.android.support:appcompat-v7:27.0.1'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:design:27.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'it.sephiroth.android.library.easing:android-easing:+'
implementation 'com.facebook.android:facebook-login:4.27.0'
implementation 'com.android.support:recyclerview-v7:27.0.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.github.bumptech.glide:glide:4.0.0'
implementation 'com.google.android.gms:play-services-auth:11.6.2'
implementation 'com.afollestad:sectioned-recyclerview:0.5.0'
implementation 'com.onesignal:OneSignal:[3.6.2, 3.99.99]'
implementation 'com.paypal.sdk:paypal-android-sdk:2.15.3'
testImplementation 'junit:junit:4.12'
}
试图启用multidex
修改你的build.gradle
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
defaultConfig {
multiDexEnabled true
}
在您的清单文件中定义您的应用程序名称属性
android:name="com.pkg.YouApplication"
将其包含在Application类中
public class YouApplication extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
我有同样的问题,它与更新compile 'com.google.android.gms: play-services: 11.4.2
相关联到compile' com.google.android.gms: play-services: 11.6.0
返回旧版本的播放服务