Error: Program type already present: com.google.android.gms.common.api.internal.zzb

2,196 views
Skip to first unread message

董維誠

unread,
May 21, 2019, 2:44:20 AM5/21/19
to Google Mobile Ads SDK Developers
Hi
My Unity project had already imported firebase SDK, and after I imported Admob SDK and click Android Resolver at Unity then I can't build apk successfully.
the error is 
"Program type already present: com.google.android.gms.common.api.internal.zza Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes."
After tested, it seems these two package have same reference with "com.google.android.gms.common.api.internal" maybe.

1558416160097.jpg






































Because after I deleted one of them, the apk can build successfully.
But the app would crash at launch.
I read the document at "https://developer.android.com/studio/build/dependencies#duplicate_classes" and do some test, still can't solve this problem.
Hope some help.

Best Regards,
Jason

Mobile Ads SDK Forum Advisor Prod

unread,
May 21, 2019, 4:18:06 AM5/21/19
to jasont...@gmail.com, google-adm...@googlegroups.com
Hi,

Thank you for reaching out to us.

For us to assist you further, could you please provide us the following using Reply privately to author option?
  • List of firebase packages you imported
  • AdMob Unity plugin
  • A project (or at least a test project) where the issue is reproducible
Regards,
Teejay Pimentel
Mobile Ads SDK Team

ref:_00D1U1174p._5001UAqDVo:ref

董維誠

unread,
May 22, 2019, 10:27:41 PM5/22/19
to Google Mobile Ads SDK Developers
Hi
I had reply you privately for the detail.
Would you got that?

mobileadssdkforumadvisor於 2019年5月21日星期二 UTC+8下午4時18分06秒寫道:

Mobile Ads SDK Forum Advisor Prod

unread,
May 22, 2019, 11:44:46 PM5/22/19
to jasont...@gmail.com, google-adm...@googlegroups.com

Hi,

Thank you for providing the details privately.

Could you confirm if you have imported the firebase packages using from this link and AdMob packages from this link? If not, could you please import the said packages provided and get back to us with your findings?



Regards,
Teejay Pimentel
Mobile Ads SDK Team



ref:_00D1U1174p._5001UAqDVo:ref

Mobile Ads SDK Forum Advisor Prod

unread,
May 22, 2019, 11:49:07 PM5/22/19
to jasont...@gmail.com, google-adm...@googlegroups.com

董維誠

unread,
May 23, 2019, 1:10:55 AM5/23/19
to Google Mobile Ads SDK Developers
Hi
I enabled custom gradle build config to build the apk.
This is the dependencies which auto generated by Unity

螢幕快照 2019-05-23 下午1.06.59.png
































And get another error description as below
D8: Type com.google.android.gms.common.internal.zzj is referenced as an interface from `com.google.android.gms.common.api.internal.zzbu`.
D8: Type com.google.android.gms.common.internal.zzj is referenced as an interface from `com.google.android.gms.common.api.internal.zzaq`.
com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process

Would you figure out something wrong?


mobileadssdkforumadvisor於 2019年5月23日星期四 UTC+8上午11時49分07秒寫道:
mainTemplate.gradle

Mobile Ads SDK Forum Advisor Prod

unread,
May 23, 2019, 6:38:48 AM5/23/19
to jasont...@gmail.com, google-adm...@googlegroups.com
Hi,

I discussed this to with the rest of the team and It seems that your concern is no longer related to the Mobile Ads SDK implementation.

On the other hand, we checked your plugins in Unity and found out that the plugins were using mismatch version of the prerequisite Android packages. 
To resolve this, please follow the steps below
  1. In Unity, search each plugins' dependency xml (eg. GoogleMobileAdsDependencies.xml and OneSignalDependencies.xml)
  2. For each <androidPackage>, Change them to the highest version if possible. More importantly, the play store packages must have matching versions
  3. Force Resolve using the Play Services Resolver
  4. Export the project
  5. In Android Studio, check the resulting build gradle. Kindly follow the version re-matching (or updating) that Android Studio suggests for each 'implementation' / 'compile' line.
If you still encounter any issues, I would suggest to raise this to Stackoverflow to get their insights regarding your concern.
Reply all
Reply to author
Forward
0 new messages