Android - 意想不到的顶级例外:

时间:2016-05-09 07:45:16

标签: android multidex payumoney

我在app中添加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.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(app)文件代码

apply plugin: 'com.android.application'

android {     compileSdkVersion 23     buildToolsVersion“23.0.3”

defaultConfig {
    applicationId "com.xxxxxxxxxxx"
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}}
repositories {
maven { url "https://jitpack.io" }}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.github.PhilJay:MPAndroidChart:v2.2.3'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.squareup.picasso:picasso:2.3.2'
compile project(':viewPagerLib')
compile project(':PayU-release')
compile project(':sdkui')
compile 'com.google.android.gms:play-services:8.4.0'}

这是build.gradle(项目)

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:1.5.0'
    classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
    classpath 'com.github.dcendents:android-maven-plugin:1.2'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}}

allprojects {
repositories {
    jcenter()
}}

task clean(type: Delete) {
delete rootProject.buildDir}

如果我在build.gradle中使用multidex true,则错误已解决,但应用程序在第一个屏幕上崩溃。

2 个答案:

答案 0 :(得分:0)

添加以下依赖项:

$d_array = unique_multidim_array($newlinksDataArr, "link");

另外,minifyEnabled为true;

然后在您的应用程序类中添加以下内容:

compile 'com.android.support:multidex:1.0.1'

答案 1 :(得分:0)

删除此

 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'