任务应用程序执行失败:dexDebug

时间:2015-11-06 20:38:23

标签: android android-gradle material-design

这是我的gradle文件

julia> f{T}() = show(T)
WARNING: static parameter T does not occur in signature for f at none:1.
The method will not be callable.
f (generic function with 1 method)

运行项目后的消息gradle构建 这个错误

错误:任务':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

3 个答案:

答案 0 :(得分: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')
}

答案 1 :(得分: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
}

答案 2 :(得分:-1)

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

    compile ("alibpath") {
       transitive = false
    }
    

    跳过传递库。

    1. 另一种可能性是你的libs中有java。* javax。*类,dex不喜欢它。