2016-08-29 4 views
1

에뮬레이터뿐 아니라 Android 디바이스에서 프로젝트를 실행하려고합니다. 하지만 불행히도 나는 두 가지 오류가 발생합니다.android studio에서 프로젝트를 실행할 수 없습니다.

오류 1 :

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 

오류 2 :

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 '/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2 
+2

이 시도 : http://stackoverflow.com/questions/26609734/how-to-enable-multidexing-with-the-new-android-multidex-support-library을 당신은 링크가있다 multidex 지원 –

+0

오류 메시지에서 바로 그것을 따르고 64k 메소드 제한이 무엇인지 알아보십시오. Multidex는 여러분이보고 있어야 할 첫 번째 해결책이 아니며 프로젝트의 종속성을 검토하고 사용되지 않는 솔루션은 제거합니다. – Adnan

+0

을 추가해야 – Egor

답변

1

나도 얼마 전에 첫 번째 문제 같은 몇 가지 문제가 있었다. defaultConfig에서 multiDexEnabled true을 사용하여 해결했습니다. 당신은 그것을 밖으로 시도해야합니다! 당신의 build.gradle에서

+0

defaultConfig에 "multiDexEnabled true"를 추가하고 "com.android.support:multidex:1.0.0 '"을 (를) 종속성에 추가했습니다. 또한 "MultiDex.install (this);"이 추가되었습니다. Singlton 수업. 여전히 같은 오류가 발생합니다. – user3563459

+0

나 같은 경우. : – Zarashi99

0

:

android { 
compileSdkVersion 22 
buildToolsVersion "23.0.0" 

    defaultConfig { 
     minSdkVersion 14 //lower than 14 doesn't support multidex 
     targetSdkVersion 22 

     // Enabling multidex support. 
     multiDexEnabled true 
    } 
} 

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

그런 다음 당신은 그것으로이 조각을 MultiDexApplication에서 응용 프로그램 클래스를 확장하거나 포함해야합니다

public class YouApplication extends Application { 

    @Override 
    protected void attachBaseContext(Context base) { 
     super.attachBaseContext(base); 
     MultiDex.install(this); 
    } 

} 

Here 공식 가이드입니다.

+0

defaultConfig에 "multiDexEnabled true"를 추가하고 "com.android.support:multidex:1.0.0 ''을 (를) 종속성에 추가했습니다. 또한 Singlton 클래스에"MultiDex.install (this); "을 추가했습니다. 오류. – user3563459

+0

AndroidManifest에서 응용 프로그램 클래스를 적용 했습니까? –

+0

예. AndroidManifest에도 추가했습니다. – user3563459

관련 문제