Leandro Borges Ferreira
Leandro Borges Ferreira

Reputation: 12792

Multidex not working only in AndroidTest

I have a project that has MultiDex and it compiles the app just fine... But when I try to run the instrumented tests I get this error:

Error:Execution failed for task ':app:transformDexArchiveWithDexMergerForMinApi16StagingDebugAndroidTest'.

com.android.build.api.transform.TransformException: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536

I am using

testInstrumentationRunner 'com.android.test.runner.MultiDexTestRunner'

In my gradle file.

How can I make the multdex work?

Upvotes: 1

Views: 669

Answers (2)

zureka
zureka

Reputation: 66

Multidex on KitKat isn't very well supported. There are support libraries that allow you to run your multidexed Android app on KitKat but those can't help you when your androidTest APK is also multidexed. I wrote more about it in this blog post so I could remember how to solve this in the future for other apps.

I'm not sure if it is the exact problem that you're experiencing, but I hope it helps you in some way.

In addition to this, there appears to be others that have a similar problem to the one you're describing. Have you tried this solution?

Upvotes: 1

Leandro Borges Ferreira
Leandro Borges Ferreira

Reputation: 12792

In case for any one looking for a answer to this. It is not currently possible to use multidex in the API 19 and lower with AGP 3.0.0 you can track the issue here: https://issuetracker.google.com/issues/37324038

Upvotes: 0

Related Questions