Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/229.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android studio 3.0.1显示无法合并dex为什么?_Android_Android Gradle Plugin_Dex - Fatal编程技术网

android studio 3.0.1显示无法合并dex为什么?

android studio 3.0.1显示无法合并dex为什么?,android,android-gradle-plugin,dex,Android,Android Gradle Plugin,Dex,在成功导入gradle building项目后,我将android studio 2.x.x升级为android studio 3.0.1。但在安装显示错误消息的应用程序时 Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. > com.android.builder.dexing.DexArchiveMergerException: Unable to m

在成功导入gradle building项目后,我将android studio 2.x.x升级为android studio 3.0.1。但在安装显示错误消息的应用程序时

Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
下面给出了我的应用程序grdle

为什么会显示此错误以及如何修复它?无法在模拟器上安装应用程序

已经在android studio中尝试了“清理并重建”选项,但没有解决此问题

如果您的minSdkVersion设置为21或更高

android {
    defaultConfig {
        ...
        minSdkVersion 21 
        targetSdkVersion 26
        multiDexEnabled true
    }
    ...
}
如果您的MinSDK版本设置为20或更低

android {
    defaultConfig {
        ...
        minSdkVersion 15 
        targetSdkVersion 26
        multiDexEnabled true
    }
    ...
}

dependencies {
  compile 'com.android.support:multidex:1.0.1'
}
如果无法解决此问题,请尝试浏览这些帖子,或尝试以下内容

如果您的minSdkVersion设置为21或更高

android {
    defaultConfig {
        ...
        minSdkVersion 21 
        targetSdkVersion 26
        multiDexEnabled true
    }
    ...
}
如果您的MinSDK版本设置为20或更低

android {
    defaultConfig {
        ...
        minSdkVersion 15 
        targetSdkVersion 26
        multiDexEnabled true
    }
    ...
}

dependencies {
  compile 'com.android.support:multidex:1.0.1'
}

如果这个问题没有解决,请尝试通过这些帖子,或者

删除这个Dex问题,只需实现一个依赖项。 当我们使用来自同一服务器的多个不同服务时,会出现此问题。假设我们在一个项目中使用ads和Firestore,并且都有一个存储库maven。因此,我们需要在存储库上调用不同的数据,我们需要dex依赖关系来实现。 新的更新依赖项:-

 implementation 'com.android.support:multidex:1.0.3'
或者在编译内部使用testCompile,例如:

implementation 'com.google.android.gms:play-services-ads:15.0.1'
    testCompile 'com.google.firebase:firebase-firestore:17.0.1'
并使
multiDexEnabled为真

100%会成功的

要删除这个Dex问题,只需实现一个依赖项。 当我们使用来自同一服务器的多个不同服务时,会出现此问题。假设我们在一个项目中使用ads和Firestore,并且都有一个存储库maven。因此,我们需要在存储库上调用不同的数据,我们需要dex依赖关系来实现。 新的更新依赖项:-

 implementation 'com.android.support:multidex:1.0.3'
或者在编译内部使用testCompile,例如:

implementation 'com.google.android.gms:play-services-ads:15.0.1'
    testCompile 'com.google.firebase:firebase-firestore:17.0.1'
并使
multiDexEnabled为真

100%会成功的

可能重复尝试清理项目并重新生成可能重复尝试清理项目并重新生成