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' 추가

 

 

번호 제목 글쓴이 날짜 조회 수
28 Android Studio for beginners, Part 3: Build and run the app file 황제낙엽 2018.02.02 214
27 Android Studio for beginners, Part 2: Explore and code the app(2) file 황제낙엽 2018.02.02 149
26 Android Studio for beginners, Part 2: Explore and code the app(1) file 황제낙엽 2018.02.02 147
25 Android Studio for beginners, Part 1: Installation and setup file 황제낙엽 2018.02.02 170
24 SDK와 NDK, 그리고 PDK 황제낙엽 2018.01.30 203
23 Error:Execution failed for task ':app:lintVitalRelease'. 황제낙엽 2018.01.29 908
» Error:The number of method references in a .dex file cannot exceed 64K. 황제낙엽 2018.01.29 247
21 30일 기한 Google Play 개발자 약관 위반 알림 황제낙엽 2018.01.21 240
20 애니메이션 샘플 예제들 file 황제낙엽 2018.01.08 281
19 ConstraintLayout으로 숫자패드 레이아웃을 file 황제낙엽 2017.11.09 266
18 RecyclerView란? (RecyclerView와 ListView 차이) file 황제낙엽 2017.09.11 284
17 Android - Actionbar에 tab을 추가하고 스와이프 동작으로 화면 전환 구현( ViewPager와 FragmentPagerAdapter 사용) file 황제낙엽 2017.09.11 391
16 HTTP 프로토콜을 이용한 Json Post 보내고 받기 file 황제낙엽 2017.08.03 918
15 HttpURLConnection 에서 세션 유지하기(쿠키 사용) 황제낙엽 2017.08.03 775
14 Android HttpURLConnection클래스로 POST 요청하기 황제낙엽 2017.08.01 197
13 Android’s HTTP Clients & Apache HTTP Client 어느것이 성능이 더 좋을까? 황제낙엽 2017.07.31 290
12 프로젝트의 AndroidManifest.xml 파일의 내용 file 황제낙엽 2017.07.25 180
11 구글의 안드로이드 개발자들이 만든 애플리케이션 모음 (Apps for Android ) file 황제낙엽 2017.07.25 199
10 크롬에서 디바이스(스마트폰) 연결 정보 확인 황제낙엽 2017.03.28 316
9 JNI 사용시 Android.mk와 Application.mk에 대해서 황제낙엽 2017.03.28 168