sitelink1 | http://skysoo1111.tistory.com/24 |
---|---|
sitelink2 | |
sitelink3 |
Information:Gradle tasks [assemble]
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
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\Android\Android Studio\jre\bin\java.exe'' finished with non-zero exit value 2
Information:BUILD FAILED
Information:Total time: 1 mins 39.468 secs
Information:2 errors
Information:0 warnings
Information:See complete output in console
안드로이드 멀티덱스 문제로 메서드 수가 약 65000개 이상이 되면 빌드시 에러가 발생하는 상황입니다.
해결 방법
app\build.gradle 에 다음과 같은 라인을 추가
android {
...
defaultConfig {
...
multiDexEnabled true
}
...
dexOptions{
javaMaxHeapSize = "4g"
}
}
dependencies {
...
compile 'com.android.support:multidex:1.0.0'
}
해당 App의 build.gradle(Module:app)에서 위와 같은 내용을 추가 해주면 된다.
defaultConfig 안에 multiDexEnabled true 추가
dexOptions{ javaMaxHeapSize = "4g" } 추가
dependencies 안에 compile 'com.android.support:multidex:1.0.0' 추가