在Android Studio中运行应用程序时执行失败

时间:2016-06-27 21:37:49

标签: java android gradle

我正在开发Java Android程序,其中包含一个登录系统,该系统通过webservice与数据库进行通信。当我添加加密算法和必要的jar时,我收到以下错误:

错误:任务':app:transformClassesWithDexForDebug'执行失败。

  

com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程'命令'C:\ Program Files \ Java \ jdk1.7.0_45 \ bin \ java.exe''已完成具有非零退出值1

这是我的gradle文件:

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
    applicationId "andreea.example.com.mobileapp"
    minSdkVersion 16
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile files('libs/apache-httpcomponents-httpclient.jar')
compile files('libs/apache-httpcomponents-httpcore.jar')
compile files('libs/jsr177.jar')
compile files('libs/commons-lang3-3.4.jar')
compile files('libs/android-support-v4.jar')
compile files('libs/commons-codec-1.10.jar')
compile files('libs/commons-io-2.4.jar')
compile files('libs/commons-lang3-3.4.jar')
}

[UPDATE] 我已经解决了上一个问题,但我现在收到以下错误: (我还添加了 - multiDexEnabled true - in gradle)

错误:任务':app:transformClassesWithJarMergingForDebug'执行失败。

  

com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:android / support / annotation / DrawableRes.class

1 个答案:

答案 0 :(得分:0)

很可能是因为65K而你需要启用multidex。但这只是猜测。

要了解此问题,您可以尝试使用

从控制台构建项目
  

gradle build --debug

  

gradle build --info

之后你需要阅读或分享输出。