Hello,
Thanks for this lib' !
I am using AdMobRewarded component which is working pretty well on iOS. I would like to test this component on Android but I'm facing some problems in the installation.
I went through all the issues of the library and I followed especially the instructions of #45 #69 #202
I ran react-native link but I had to add by hand some elements in MainApplication.java (#69) :
import com.sbugert.rnadmob.RNAdMobPackage;
new RNAdMobPackage()
Before adding those lines, I was able to launch well this app, but it generates an error like one mention in #140 / #72
TypeError: undefined is not a function (evaluating '_reactNativeAdmob.AdMobRewarded.setAdUnitID...'
After adding new RNAdMobPackage() in MainApplication.java, I build the project with success but immediately crash on launch (nothing in logs)
=> Any ideas ?
Thanks a lot for your help !
See below my configuration :
settings.gradle
include ':react-native-admob'
project(':react-native-admob').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-admob/android')
build.gradle
implementation (project(':react-native-admob')) {
exclude group: 'com.google.android.gms'
}
...
apply plugin: 'com.google.gms.google-services'
MainApplication.java
import com.sbugert.rnadmob.RNAdMobPackage;
...
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
...
new RNAdMobPackage()
);
i have the same issue but just for android version 4.1 till 5.0.0
and it works on 5.0.0 and newest
@Mifayo Thanks for your answer, but i try but it's also not working on my real device (android 5.1.1)...
@clementinoux we have the same config but in build.gradle inside app only have this in dependencies
compile project(':react-native-admob')
I guess I need to add this dependencies in build.gradle:
implementation ('com.google.android.gms:play-services-ads:12.+') {
force = true;
}
@clementinoux is it works for you ?
Without any logs this is quite hard to debug. Is there maybe an option to increase logging verbosity? Also, are you running on device or in an emulator?
@koenpunt @Mifayo @clementinoux I am also facing this issue. Can anyone please tell me how to fix this issue.
You can resolve this issue by reading the Google Admob documentation
In your AndroidManifest.xml you need to add these lines:
<!-- replace [ADMOB_APP_ID] by your actual AdMob App ID, i.e. ca-app-pub-....~.... -->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="[ADMOB_APP_ID]"/>
You obviously need an AdMob account and register an App on it, to retrieve the right AdbMob App ID.
@koenpunt @Mifayo @clementinoux I am also facing this issue. Can anyone please tell me how to fix this issue.
implementation ('com.google.android.gms:play-services-ads:12.+') { force = true; }
add this to android/app/build.graddle
Most helpful comment
implementation ('com.google.android.gms:play-services-ads:12.+') { force = true; }add this to android/app/build.graddle