-1

我在应用程序中添加 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(project)

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,则错误已解决,但应用程序在第一个屏幕上崩溃。

4

2 回答 2

0

添加以下依赖项:

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

此外, minifyEnabled 为真;

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

 @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }
于 2016-05-09T07:58:11.237 回答
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'
于 2016-05-09T07:59:37.753 回答