2015-11-06 89 views
1

这个我gradle这个文件运行项目 此错误执行失败任务的应用程序:dexDebug

错误后

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 21 
buildToolsVersion "22.0.1" 

defaultConfig { 
    applicationId "done.ui" 
    minSdkVersion 16 
    targetSdkVersion 21 
    versionCode 1 
    versionName "1.0" 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
} 
repositories { 
    mavenCentral() 
     maven { 
    url "https://jitpack.io" 
} 
} 
dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
compile 'com.android.support:appcompat-v7:22.2.1' 
compile 'com.android.support:recyclerview-v7:22.2.+' 
compile 'com.google.android.gms:play-services:7.5.0' 
compile 'com.facebook.android:facebook-android-sdk:4.2.0' 
compile 'com.pubnub:pubnub-android:3.7.4' 
compile 'com.amazonaws:aws-android-sdk-core:2.+' 
compile 'com.amazonaws:aws-android-sdk-cognito:2.+' 
compile 'com.amazonaws:aws-android-sdk-ddb:2.+' 
compile 'com.amazonaws:aws-android-sdk-ddb-mapper:2.+' 
compile 'com.android.support:cardview-v7:21.0.+' 
compile 'com.github.clans:fab:1.5.5' 
compile 'com.melnykov:floatingactionbutton:1.3.0' 
compile 'com.github.ksoichiro:android-observablescrollview:1.5.0' 
compile 'com.nineoldandroids:library:2.4.0' 
compile 'com.github.kanytu:android-parallax-recyclerview:v1.4' 
compile files('libs/PayPalAndroidSDK-2.8.5.jar') 
} 

消息gradle这个编译:执行失败的任务 ':应用程序:dexDebug'。

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_80\bin\java.exe'' finished with non-zero exit value 2

+0

它可以帮助发布更多的错误 - 这是gradle进程异常。它告诉你,它正在运行的java进程中有一个错误 - 所以在这之前有另一个错误。 – Jim

+0

使用./gradlew assemble --info并发布堆栈跟踪 –

+0

失败:生成失败并出现异常。 *出错: 任务':app:dexDebug'的执行失败。 > com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程'命令'C:\ Program Files \ Java \ jdk1.7.0_80 \ bin \ java.exe''已完成非零退出值2 *尝试: 使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。 我想使这个命令如何? – yousef

回答

0

试试这个

您使用buildToolsVersion 22和您的compileSdkVersiontargetSdkVersion是21

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 22 
buildToolsVersion "22.0.1" 

defaultConfig { 
    applicationId "done.ui" 
    minSdkVersion 16 
    targetSdkVersion 22 
    versionCode 1 
    versionName "1.0" 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
} 
repositories { 
    mavenCentral() 
     maven { 
    url "https://jitpack.io" 
} 
} 
dependencies { 
compile fileTree(dir: 'libs', exclude: 'android-support-v4.jar', include: ['*.jar']) 
compile 'com.android.support:appcompat-v7:22.2.1' 
compile 'com.android.support:recyclerview-v7:22.2.+' 
compile 'com.google.android.gms:play-services:7.5.0' 
compile 'com.facebook.android:facebook-android-sdk:4.2.0' 
compile 'com.pubnub:pubnub-android:3.7.4' 
compile 'com.amazonaws:aws-android-sdk-core:2.+' 
compile 'com.amazonaws:aws-android-sdk-cognito:2.+' 
compile 'com.amazonaws:aws-android-sdk-ddb:2.+' 
compile 'com.amazonaws:aws-android-sdk-ddb-mapper:2.+' 
compile 'com.android.support:cardview-v7:21.0.+' 
compile 'com.github.clans:fab:1.5.5' 
compile 'com.melnykov:floatingactionbutton:1.3.0' 
compile 'com.github.ksoichiro:android-observablescrollview:1.5.0' 
compile 'com.nineoldandroids:library:2.4.0' 
compile 'com.github.kanytu:android-parallax-recyclerview:v1.4' 
compile files('libs/PayPalAndroidSDK-2.8.5.jar') 
} 
+0

不工作我得到同样的错误@Michele Lacorte – yousef

+0

更新构建工具23.0.2和sdk到23 –

-1
  1. 使用--debug选项,以获取更详细的输出。 有可能你有依赖冲突和dex试图从不同的库中处理相同的类文件并失败。如果是这种情况,你应该过滤掉你不需要的库。

使用:

compile ("alibpath") { 
    transitive = false 
} 

跳过传递库。

  1. 另一种可能是你的libs中有java。* javax。*类,dex不喜欢它。
0
dependencies { 
//compile fileTree(dir: 'libs', include: ['*.jar'])//<==Just comment this line 
compile 'com.android.support:appcompat-v7:22.2.1' 
compile 'com.android.support:recyclerview-v7:22.2.+' 
compile 'com.google.android.gms:play-services:7.5.0' 
compile 'com.facebook.android:facebook-android-sdk:4.2.0' 
compile 'com.pubnub:pubnub-android:3.7.4' 
compile 'com.amazonaws:aws-android-sdk-core:2.+' 
compile 'com.amazonaws:aws-android-sdk-cognito:2.+' 
compile 'com.amazonaws:aws-android-sdk-ddb:2.+' 
compile 'com.amazonaws:aws-android-sdk-ddb-mapper:2.+' 
compile 'com.android.support:cardview-v7:21.0.+' 
compile 'com.github.clans:fab:1.5.5' 
compile 'com.melnykov:floatingactionbutton:1.3.0' 
compile 'com.github.ksoichiro:android-observablescrollview:1.5.0' 
compile 'com.nineoldandroids:library:2.4.0' 
compile 'com.github.kanytu:android-parallax-recyclerview:v1.4' 
compile files('libs/PayPalAndroidSDK-2.8.5.jar') 
} 

评论这条线,并重新构建再次就是这样compile fileTree(dir: 'libs', include: ['*.jar'])

,不要忘记添加此

defaultConfig { 
    ... 
    multiDexEnabled true 
} 
相关问题