Gradle Build Failure java.io.IOException: The outp

2019-07-17 08:13发布

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

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?

2条回答
Summer. ? 凉城
2楼-- · 2019-07-17 09:03

You should use testInstrumentationRunner:

com.android.test.runner.MultiDexTestRunner
查看更多
啃猪蹄的小仙女
3楼-- · 2019-07-17 09:05

Setting multiDexEnabled to false worked for me.

查看更多
登录 后发表回答