Android Getting R8 error: Already has a mapping when trying to run UI tests with minified build Code Answer

I want to be able to run UI tests on a minified build. However when I run

 ./gradlew connectedDebugAndroidTest

I get this error:

> Task :app:minifyDebugAndroidTestWithR8
R8: 'void zza(,int,android.os.IInterface)' already has a mapping

I tried creating a separate proguard file for the tests:

buildTypes {
        debug {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), ''
            testProguardFile ''
-keepattributes SourceFile,LineNumberTable

But that didn’t help. Not sure what else to try.


There has been a number of “Already has a mapping” issues (the most recent being All known issues of this kind has been fixed for Android Studio 4.2 (currently on preview,

One can also use AGP 4.2.0-rc01 without having to update Android Studio by using this dependency: in the top level build.gradle file.

Related Posts

© No Copyrights, All Questions are retrived from public domain.
Tutorial Guruji