Android-意外的顶级异常:
我在应用程序中添加payumoney时遇到错误。 这是一个错误- 意外的顶级异常:Android-意外的顶级异常:,android,android-multidex,payumoney,Android,Android Multidex,Payumoney,我在应用程序中添加payumoney时遇到错误。 这是一个错误- 意外的顶级异常: `com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536 at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:484) at com.android.dx.merge.DexMerger$IdMerger.me
`com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:484)
at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:261)
at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:473)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:161)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
atcom.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java0)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)`
下面是build.gradle(应用程序)文件代码
apply plugin: 'com.android.application'
安卓{
编译DK23版
buildToolsVersion“23.0.3”
这是build.gradle(项目)
如果在build.gradle中使用multidex true,则错误已解决,但应用程序会在第一个屏幕上崩溃。添加以下依赖项:
compile 'com.android.support:multidex:1.0.1'
此外,minifyEnabled true
然后在应用程序类中添加以下内容:
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
去掉这个
compile 'com.google.android.gms:play-services:8.4.0'
加上这个
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
如果重写应用程序类,则不需要重写attachBaseContext方法,只需将其更改为扩展MultiDexApplication(如果可能),如下所示:公共类MyApplication扩展MultiDexApplication{…}
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'