dex文件不能超过64k的错误

时间:2016-10-20 07:45:10

标签: android

你好我不能建立apk因为这个错误 谁能解决这个问题给我。 "注意" ,只是我打开一个新的地图项目,然后建立apk然后它显示我这个错误

Information:BUILD FAILED
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_102\bin\java.exe'' finished with non-zero exit value 2
:app:transformClassesWithDexForDebug FAILED
Error:The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
For more information see https://docs.gradle.org/current/userguide/build_environment.html
To do this set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties.
For faster builds, increase the maximum heap size for the Gradle daemon to more than 2048 MB.
It currently has approximately 910 MB.
To run dex in process, the Gradle daemon needs a larger heap.

1 个答案:

答案 0 :(得分:0)

对我而言,在gradle中启用multidex选项就足够了

...   
 defaultConfig {

            ...
            multiDexEnabled true
    ...
        }
...