Abhay Koradiya
Abhay Koradiya

Reputation: 2117

Program type already present: com.google.android.gms.common.util.VisibleForTesting

Hello I am getting following Error. I searched a lot, But none of the solution worked for me.

Caused by: com.android.builder.multidex.D8MainDexList$MainDexListException: com.android.tools.r8.errors.CompilationError: Program type already present: com.google.android.gms.common.util.VisibleForTesting

My Gradle

dependencies {
    implementation('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
        transitive = true;
    }
    implementation 'com.android.support:multidex:1.0.3'
    implementation files('libs/AdiquityAndroidSDK.jar')
    implementation files('libs/gdx-backend-android.jar')
    implementation files('libs/libGoogleAnalyticsServices.jar')
    implementation files('src/main/jniLibs/gdx.jar')
//    implementation files('src/main/jniLibs/gdx-backend-android.jar')
    implementation 'com.google.android.gms:play-services-ads:15.0.1'
    implementation 'com.facebook.android:facebook-android-sdk:4.33.0'
}

I have also used latest gms plugin.

classpath 'com.google.gms:google-services:4.0.1'

with gradle-wrapper 4.4 and build gradle 3.1.3.

Please Help me How to solve this.

Upvotes: 3

Views: 1669

Answers (2)

Geet Thakur
Geet Thakur

Reputation: 2056

In My case after downgrading "play services" back to version 12 issue is successfully fixed.

change

implementation('com.google.android.gms:play-services-gcm:16.0.0') {
        exclude module: 'guava-jdk5'
    }
    implementation ('com.google.android.gms:play-services-maps:16.0.0'){
        exclude module: 'guava-jdk5'
    }

to

implementation('com.google.android.gms:play-services-gcm:12.0.0') {
        exclude module: 'guava-jdk5'
    }
    implementation ('com.google.android.gms:play-services-maps:12.0.0'){
        exclude module: 'guava-jdk5'
    }

Upvotes: 1

Abhay Koradiya
Abhay Koradiya

Reputation: 2117

After Searching a lot, getting Solution.

after remove implementation files('libs/libGoogleAnalyticsServices.jar') issue solved.

The issue was that the file with the same package and file name was present in two different jars one jar was of old google analytics services jar.

We have to resolve this conflict (I had removed my old jar as it was no longer needed) and the project would build.

Upvotes: 3

Related Questions