2

I'm trying to run an espresso test on MultiDex app and am failing with the below error

Error:Execution failed for task > :transformClassesWithMultidexlistForDebugAndroidTest'. java.io.IOException: The output jar is empty. Did you specify the proper > '-keep' options?

Here's the relevant section in my build.gradle

defaultConfig {
        ...
        //      Enabling multidex support.
        multiDexEnabled true
        dexOptions {
            jumboMode true
        }

        testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
    }

I do have a workaround which is to:

  1. comment out 'testInstrumentationRunner' line
  2. Build the test
  3. Uncomment the line
  4. Run the test

This seems to work, but I need to re-do this any time I'm changing my test code, which is a major pain.

Could fine similar error online, but nothing specific to my case...

I am building using Android studio

Rafi Goldfarb
  • 571
  • 4
  • 9

1 Answers1

0

My reputation doesn't allow me to comment, so will write as an answer:

Exactly the same workaround works for me:

  1. Commenting the string with 'testInstumentationRunner'
  2. Building tests. There will be an exception that Instrumentation Runner is not found
  3. Uncomment the string
  4. Run the test

UPD: This solution worked for me, though the question there is about different problem:

Android Espresso not working with Multidex gives "No tests found"

Community
  • 1
  • 1