【问题标题】:Execution failed for task : app:dexDebug任务执行失败:app:dexDebug
【发布时间】:2015-12-22 12:54:06
【问题描述】:

当我运行我的 android 项目时,出现以下错误::

Error:Execution failed for task ':app: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 3

我尝试了 Build->Clean Project 但徒劳无功。Alos 我尝试了“使用 gradle 文件同步项目”但徒劳无功。我的 build.gradle 文件是:

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"


defaultConfig {
    applicationId "com.sevenhorse.almabay"
    // Enabling multidex support.
    multiDexEnabled true
    minSdkVersion 14
    targetSdkVersion 23
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}

  packagingOptions {
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/dependencies.txt'
    exclude 'META-INF/LGPL2.1'
}
}

dependencies {
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:design:23.0.1'
compile 'com.google.code.gson:gson:2.2.+'
compile files('libs/google-api-client-1.19.0.jar')


 //compile files('libs/google-api-client-android-1.19.0.jar')
compile files('libs/google-api-services-youtube-v3-rev124-1.19.0.jar')
compile files('libs/google-http-client-1.19.0.jar')
//  compile files('libs/google-http-client-android-1.19.0.jar')


 compile files('libs/google-http-client-jackson2-1.19.0.jar')
compile files('libs/google-oauth-client-1.19.0.jar')
compile files('libs/httpclient-4.3.6.jar')
compile files('libs/httpcore-4.3.3.jar')
compile files('libs/httpmime-4.3.6.jar')
compile files('libs/jackson-core-2.1.3.jar')
compile files('libs/jsr305-1.3.9.jar')
compile files('libs/picasso-2.3.3.jar')
compile files('libs/universal-image-loader-1.6.1-with-src.jar')
compile files('libs/volley.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.android.support:multidex:1.0.0'
}

我也做了 minifyEnabled true 但不起作用。请帮我解决问题。

【问题讨论】:

  • 你能分享完整的错误日志吗?
  • 初集compile 'com.google.code.gson:gson:2.3.1'
  • 好的,测试用例注释掉compile files('libs/google-api-client-1.19.0.jar')
  • 使用compile 'com.android.support:multidex:1.0.1'
  • @IntelliJAmiya :我还面临另一个问题,即构建项目需要太多时间

标签: android build.gradle dex


【解决方案1】:

不要将播放服务直接包含在 build.gradle 中

编译'com.google.android.gms:play-services:8.3.0'

仅使用您的应用程序所需的播放服务库模块

仅适用于应用的 GCM 和 Google Analytics

编译'com.google.android.gms:play-services-gcm:8.3.0'

编译'com.google.android.gms:play-services-analytics:8.3.0'

【讨论】:

  • 您能否将答案勾选为已接受。会帮助其他人,将不胜感激
猜你喜欢
  • 2015-08-23
  • 1970-01-01
  • 2015-06-10
  • 1970-01-01
  • 2015-05-23
  • 2016-09-02
  • 1970-01-01
相关资源
最近更新 更多