2017-04-06 137 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

相关问题