在android studio中成功构建应用程序后,如何解决此问题
**错误:任务“:app:transformDexArchiveWithExternalLibsDexMergerForDebug”的执行失败 com.android.builder.dexing.DexArchiveMergerException:无法合并dex**在android studio中成功构建应用程序后,如何解决此问题,android,android-debug,android-studio-3.0,Android,Android Debug,Android Studio 3.0,**错误:任务“:app:transformDexArchiveWithExternalLibsDexMergerForDebug”的执行失败 com.android.builder.dexing.DexArchiveMergerException:无法合并dex** 将此添加到build.gradle文件中 android { defaultConfig { multiDexEnabled true } } 步骤1:修改模块级build.gra
将此添加到build.gradle文件中
android {
defaultConfig {
multiDexEnabled true
}
}
步骤1:修改模块级build.gradle文件以启用multidex并将multidex库添加为依赖项,如下所示:
android {
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 26
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
步骤2:如果确实重写了Application类,请将其更改为extend MultiDexApplication(如果可能),如下所示:
public class MyApplication extends MultiDexApplication { ... }
或者,如果确实重写了应用程序类,但无法更改基类,则可以重写attachBaseContext()方法并调用MultiDex.install(此)以启用MultiDex:
public class MyApplication extends SomeOtherApplication {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
更多信息请检查此项发布您的完整错误您使用什么LIB。我在使用最新的泄漏金丝雀时遇到了这种情况