When i import admob and firebase to my project, i have gradle dependencies:
api ‘com.google.android.gms:play-services-ads:17.2.0’
api ‘com.google.android.gms:play-services-base:16.1.0’
api ‘com.google.firebase:firebase-core:15.0.0’
In compile time i got error:
AGPBI: {“kind”:“error”,“text”:“Program type already present: com.google.android.gms.internal.measurement.zzdv”,“sources”:[{}],“tool”:“D8”}
If downgrade version of gms:play-services, then no rewarded video in my app, becase class not found com.google.android.gms.ads.rewarded.RewardedAdLoadCallback
all google service should have same version, try upgrade sdkbox all google service
plz try
implementation 'com.google.firebase:firebase-core:17.0.0'
New error:
AGPBI: {“kind”:“error”,“text”:“Program type already present: android.support.v4.app.INotificationSideChannel”,“sources”:[{}],“tool”:“D8”}
In new version of firebase exists dependecies androidx, but this dependencies conflicts with com.android.support dependencies from facebook.
I try exclude old deps and use only new, but receive new errors in runtime:
api ‘com.android.billingclient:billing:1.0’
api (‘com.google.android.gms:play-services-ads:17.2.0’) {
exclude group: ‘com.android.support’, module: ‘appcompat-v7’
exclude group: ‘com.android.support’, module: ‘cardview-v7’
exclude group: ‘com.android.support’, module: ‘support-v4’
exclude group: ‘com.android.support’, module: ‘customtabs’
exclude group: ‘com.android.support’, module: ‘support-annotations’
exclude group: ‘com.android.support’, module: ‘support-compat’
exclude group: ‘com.android.support’, module: ‘support-core-utils’
}
api ‘com.google.android.gms:play-services-base:17.0.0’
api ‘com.google.firebase:firebase-core:17.0.0’
api ('com.facebook.android:facebook-android-sdk:[4,5)') {
exclude group: 'com.android.support', module: 'appcompat-v7'
exclude group: 'com.android.support', module: 'cardview-v7'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'customtabs'
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'support-compat'
exclude group: 'com.android.support', module: 'support-core-utils'
}
api 'androidx.appcompat:appcompat:1.0.0'
api 'androidx.cardview:cardview:1.0.0'
api 'androidx.legacy:legacy-support-v4:1.0.0'
api 'androidx.browser:browser:1.0.0'
api 'androidx.annotation:annotation:1.0.0'
api 'androidx.core:core:1.0.0'
api 'androidx.legacy:legacy-support-core-utils:1.0.0'
I got error:
Caused by: java.lang.ClassNotFoundException: Didn’t find class “android.support.v4.content.LocalBroadcastManager”
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
If all 17 version, than androidx problem,
if all 16 version than Didn’t find class "com.google.android.gms.ads.rewarded.RewardedAdCallback
api ‘com.google.android.gms:play-services-ads:16.0.0’
api ‘com.google.android.gms:play-services-base:16.1.0’
api ‘com.google.firebase:firebase-core:16.0.0’
I got this error now.
:cpp3172:transformClassesWithDexBuilderForDebug UP-TO-DATE
AGPBI: {"kind":"error","text":"Program type already present: android.support.v4.app.INotificationSideChannel","sources":[{}],"tool":"D8"}
:cpp3172:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
solution
1. edit proj.android/build.gradle
, update tools to 3.2.0 version
classpath 'com.android.tools.build:gradle:3.2.0'
2. edit proj.android/app/gradle.properties, add bellow codes
android.enableJetifier=true
android.useAndroidX=true
test with
$ sdkbox info
_______ ______ _ _ ______ _____ _ _
|______ | \ |____/ |_____] | | \___/
______| |_____/ | \_ |_____] |_____| _/ \_
Copyright (c) 2016-2018 SDKBOX Inc. v1.0.3.0
installed packages:
v2.5.0.0 sdkboxads
v2.5.0.0 firebase
v2.5.0.0 facebook
v2.5.0.0 googleplayservices
v2.5.0.0 admob
checked with cocos compile -p android
and compile with Android Studio.
Thanks