ANDROID ERROR Program type already present: com.google.ads.AdRequest$Gender?

1k Views Asked by At

I opened my old working app in the new updated stable android studio, I got the following error when select run the app option

Program type already present: com.google.ads.AdRequest$Gender

Message{kind=ERROR, text=Program type already present: com.google.ads.AdRequest$Gender, sources=[Unknown source file], tool name=Optional.of(D8)}

I only changes to build.gradle file compile to implementation word

  dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:support-v4:27.1.1' 
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.google.firebase:firebase-messaging:17.1.0'
    implementation 'com.google.firebase:firebase-ads:15.0.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha2'

}
1

There are 1 best solutions below

0
N_J On BEST ANSWER

Oops, my bad. That error came because in lib folder also present google ads old jar file and added google ads in gradle too.

Just remove the following line and solved.

implementation fileTree(include: ['*.jar'], dir: 'libs')