无法合并dex Android Studio 3.0.1

时间:2017-11-30 11:15:20

标签: java android xml dex multidex

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'
}

2 个答案:

答案 0 :(得分:0)

尝试启用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);
    }

}

答案 1 :(得分:0)

我遇到了同样的问题,它与更新有关 def main(): f=open("name.txt","a") name=input("name:") f.writelines(name) f.close() main() compile 'com.google.android.gms: play-services: 11.4.2 返回旧版的播放服务