Gradle构建失败java.io.IOException:输出jar为空 [英] Gradle Build Failure java.io.IOException: The output jar is empty

查看:379
本文介绍了Gradle构建失败java.io.IOException:输出jar为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的android studio项目在正常运行应用程序时没有问题,但是当我尝试运行测试时,我收到以下gradle错误消息:

My android studio project builds fine when running the app normally, but when I try to run tests I get the following gradle error message:

:app:transformClassesWithMultidexlistForDebugAndroidTest FAILED
Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebugAndroidTest'.
> java.io.IOException: The output jar is empty. Did you specify the proper '-keep' options?
Information:BUILD FAILED
Information:Total time: 27.049 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

令我感到困惑的是,它指的是proguard配置文件中的-keep选项,然而proguard被禁用可以在我下面的gradle文件中看到,我有minifyEnabled真正注释掉了:

What is confusing me is that It refers to -keep options in the proguard configuration file, yet proguard is disabled, as you can see in my gradle file below, I have minifyEnabled true commented out:

apply plugin: 'com.android.application'

android {
compileSdkVersion "Google Inc.:Google APIs:23"
buildToolsVersion "23.0.1"    

defaultConfig {
    applicationId "com.wasptech.intellidroid"
    minSdkVersion 13
    versionCode 388
    targetSdkVersion 22
    versionName "2.38.08 - RC2"
    multiDexEnabled true       
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}

dexOptions {
    incremental true
    javaMaxHeapSize "4g"
}

buildTypes {
    release {
        //minifyEnabled true
        signingConfig signingConfigs.release
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'

compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:8.1.0'

compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:support-v13:23.1.1'

compile 'com.crittercism:crittercism-android-agent:5.3.3'

compile 'com.google.code.gson:gson:2.3'
compile 'com.squareup.retrofit:retrofit:1.7.1'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.squareup.okio:okio:1.0.0'
compile 'com.squareup:otto:1.3.5'
compile 'com.github.lecho:hellocharts-library:1.5.0@aar'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'

compile 'com.squareup.picasso:picasso:2.5.2'

compile 'com.jakewharton.timber:timber:3.1.0'

compile 'com.github.PhilJay:MPAndroidChart:v2.0.7'

compile 'org.osmdroid:osmdroid-android:4.3'
compile 'org.slf4j:slf4j-simple:1.6.1'

compile project(':mobihelp_sdk_android_v1.4')
compile files('libs/osmbonuspack_v5.1.jar')

compile files('libs/espresso-1.1-bundled.jar')

compile 'com.android.support.test.espresso:espresso-core:2.2'
compile 'com.android.support.test:runner:0.3'
}

如何进行疑难解答这个问题?

How do I go about troubleshooting this problem?

推荐答案

您应该使用testInstrumentationRunner:

You should use testInstrumentationRunner:

com.android.test.runner.MultiDexTestRunner

这篇关于Gradle构建失败java.io.IOException:输出jar为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆