2017-04-06 134 views
1

我曾在android studio中的android項目,當我開始運行gradle構建和顯示以下錯誤。誰能幫助我有什麼問題Android錯誤:執行失敗的任務':應用程序:transformClassesWithDexForDebug'

Error:Execution failed for task ':app:transformClassesWithDexForDebug'. com.android.build.api.transform.TransformException: 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 3

的build.gradle

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.2" 

    defaultConfig { 
     applicationId "com.stage.lookara" 
     minSdkVersion 16 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
     multiDexEnabled = true 
    } 

    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    packagingOptions { 
     exclude 'META-INF/LICENSE.txt' 
     exclude 'META-INF/NOTICE.txt' 
     exclude 'META-INF/NOTICE' 
     exclude 'META-INF/LICENSE' 
     exclude 'META-INF/DEPENDENCIES' 
    } 
    } 

    dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:23.1.1' 
    compile 'com.android.support:design:23.1.1' 
    compile files('libs/twitter4j-core-4.0.4.jar') 
    compile files('libs/slider.jar') 
    compile 'com.google.android.gms:play-services:8.3.0' 
    compile 'com.facebook.android:facebook-android-sdk:4.0.0' 
    compile 'com.etsy.android.grid:library:1.0.5' 
    compile 'com.baoyz.swipemenulistview:library:1.3.0' 
    compile files('libs/universal-image-loader-1.9.5.jar') 
    compile 'com.github.darsh2:MultipleImageSelect:v0.0.3' 
    compile files('libs/pherialize-1.2.1.jar') 
    compile 'com.wang.avi:library:2.1.3' 
    compile 'com.mikhaellopez:circularprogressbar:1.1.1' 
    compile 'com.android.support:recyclerview-v7:23.1.1' 
    compile 
    'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1' 
    compile 'com.felipecsl:gifimageview:2.1.0' 
    } 

    repositories { 
    jcenter() 
    } 

    dependencies { 
    compile 'org.adw.library:discrete-seekbar:1.0.1' 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.android.support:appcompat-v7:19.+' 
    compile 'org.jsoup:jsoup:1.7.3' 
    } 
+0

實施DEX,並把此行'multiDexEnabled TRUE'在您的build.gradle –

+1

請參閱此鏈接http://stackoverflow.com/a/33718050/6644676。 – Furqan

+0

在IDE右下方打開「Gradle控制檯」,會有更多關於該問題的信息。 – azizbekian

回答

1

正在編譯整個谷歌Play服務庫:

compile 'com.google.android.gms:play-services:8.3.0' 

可以在編譯期間跨越64K reference limit' ..

this

如果你只是使用一些服務,從庫中,你可以Selectively compiling APIs into your executable

像:

compile 'com.google.android.gms:play-services-maps:8.3.0' 
compile 'com.google.android.gms:play-services-plus:8.3.0' 
compile 'com.google.android.gms:play-services-location:8.3.0' 

我還建議真正使用最新版本的播放服務compile 'com.google.android.gms:play-services:10.2.1'

第二路

如果您想要使用整個庫:在您的應用程序中啓用Multidex

在搖籃:

android { 
    defaultConfig { 
     ... 
     minSdkVersion 15 
     targetSdkVersion 25 
     multiDexEnabled true 
    } 
    ... 
} 

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

在應用類:

public class MyApplication extends SomeOtherApplication { 
    @Override 
    protected void attachBaseContext(Context base) { 
    super.attachBaseContext(base); 
    MultiDex.install(this); 
    } 
} 

定義應用程序類的清單:

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.myapp"> 
    <application 
      android:name="android.support.multidex.MultiDexApplication" > 
     ... 
    </application> 
</manifest> 
+0

非常感謝它的工作.. – Sasi

相關問題