1. 程式人生 > >新增modoule報錯

新增modoule報錯

Error:Execution failed for task ':app:transformClassesWithDexForRelease'. > com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing java process with main class com.android.dx.command.Main with arguments {--dex --num-threads=4 --multi-dex --main-dex-list D:\workspace\MTD_Agri4.2_Android\app\build\intermediates\multi-dex\release\maindexlist.txt --output D:\workspace\MTD_Agri4.2_Android\app\build\intermediates\transforms\dex\release\folders\1000\1f\main D:\workspace\MTD_Agri4.2_Android\app\build\intermediates\transforms\proguard\release\jars\3\1f\main.jar}

第一:整個專案中,出現重複引用第三方包 

https://blog.csdn.net/u011930471/article/details/50389151 第二:其檔案的方法引用超過了65535個方法限制,  其解決方案為: 給專案進行分包操作,然後對其虛擬機器堆分配記憶體大小  在app的gradler配置檔案中,新增 multiDexEnabled true 開啟分包,然後新增

android {
    defaultConfig {
        applicationId "com.xunpige.nengwu"
        minSdkVersion 14
        targetSdkVersion 21

        multiDexEnabled true 
    }
}
android {
    dexOptions {
        javaMaxHeapSize "4g"
        preDexLibraries = false
    }
}