主要方法中有太多方法

时间:2015-09-27 08:15:12

标签: android android-multidex

我修改了build.gradle文件以配置multidex我也在官方文档中进行过研究,但新问题是"主要dex中的太多方法"如何减少main dex中的方法

build.gradle

apply plugin: 'com.android.application'



android {

defaultConfig {
    compileSdkVersion 23
    buildToolsVersion '23.0.1'
    minSdkVersion 14 //lower than 14 doesn't support multidex
    targetSdkVersion 23

    // Enabling multidex support.
    multiDexEnabled true

}
dexOptions {
    jumboMode = true

    preDexLibraries = false
    javaMaxHeapSize "2048M"
}
sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src']
        resources.srcDirs = ['src']
        aidl.srcDirs = ['src']
        renderscript.srcDirs = ['src']
        res.srcDirs = ['res']
        assets.srcDirs = ['assets']
    }

    // Move the tests to tests/java, tests/res, etc...
    instrumentTest.setRoot('tests')

    // Move the build types to build-types/<type>
    // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
    // This moves them out of them default location under src/<type>/... which would
    // conflict with src/ being used by the main source set.
    // Adding new build types or product flavors should be accompanied
    // by a similar customization.
    debug.setRoot('build-types/debug')
    release.setRoot('build-types/release')
    }
    productFlavors {
    }
    buildTypes {
    debug {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}


dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.1'
}

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

1 个答案:

答案 0 :(得分:0)

我认为您正在使用多个具有相同包名称的依赖项,例如compile 'com.google.android.gms:play-services:7.5.0' compile 'com.google.android.gms:play-services-wearable:7.5.0'