2017-03-17 1 views
1

nexus 5 기기에서 프로젝트를 만들고 실행할 때 제대로 작동합니다. apache 오류 : 'app : transformClassesWithJarMergingForDebug'작업 실행에 실패했습니다. > com.android.build.api

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lorg/apache/http/Consts;

Error:Execution failed for task ':app:transformClassesWithDexForDebug'. 
다음 내 Gradle을에 multiDexEnabled true을 추가하지만, 내가 구축하고 내 삼성 GT-I9100 (API 16)에 프로젝트를 실행할 때의 오류를 보여줍니다. 다시 컴파일하려고하면 다음과 같은 오류 메시지가 나타납니다. 오류 : 'app : transformClassesWithDexForDebug'작업 실행에 실패했습니다.

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lorg/apache/http/Consts;

그러나 다시, 내가 내 넥서스 5 (API 23)

내 응용 프로그램 Gradle을 파일을 컴파일 할 때 제대로 작동 당신은 귀하의 Gradle을에 종속성을 추가해야

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.2" 
    defaultConfig { 
     applicationId "com.project.example" 
     minSdkVersion 16 
     targetSdkVersion 25 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
     multiDexEnabled true 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 

    } 
    packagingOptions { 
     exclude 'META-INF/DEPENDENCIES' 
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/LICENSE' 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile 'com.android.support:multidex:1.0.1' 
    compile 'com.mcxiaoke.volley:library-aar:1.0.0' 
    compile 'org.apache.httpcomponents:httpcore:4.4.1' 
    compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1' 
    compile 'com.google.firebase:firebase-messaging:10.0.1' 
    compile 'com.android.support:design:25.1.1' 
    compile 'com.google.firebase:firebase-core:10.2.0' 
    compile 'com.google.firebase:firebase-database:10.2.0' 
    compile 'com.android.support:appcompat-v7:25.2.0' 
    testCompile 'junit:junit:4.12' 
} 
+0

이 등급의 파일을 게시 – Umarov

+0

@Umarov 대신 응용 프로그램 클래스에 MultiDexApllication를 확장해야 확인해 봐. 나는 그들을 편집했습니다 – VincentTheonardo

답변

0

당신의 minSkdVersion은 21 페이지의 DOCUME 후 낮부터 잘

compile 'com.android.support:multidex:1.0.1' 

multiDexEnabled true를 추가하면 작동하지 않습니다 여기 ntation Conifigure you apps for multidex

은 또한 당신은 Application

+0

나는 당신이 말한 모든 것을 끝냈습니다. 그러나 문제는 여전히 지속됩니다. – VincentTheonardo

+1

@VincentTheonardo 질문에 대한 여러분의 gradle 변경 사항도 여기에 업데이트하십시오. 다른 사람들은이 코멘트를 여기에서 읽지 않을 수도 있습니다. – Prashant

0

를 추가해보십시오 빌드 레벨 Gradle을 코드에게 다음 (build.gradle)

dexOptions { 
javaMaxHeapSize "4g" 
preDexLibraries = false 
} 
관련 문제