Closed softsstar closed 4 years ago
Same issue :/
Same issue
Same issue RN 0.60
Solved adding
configurations.all { resolutionStrategy { force "com.google.android.gms:play-services-basement:16.0.1" force "com.google.android.gms:play-services-base:16.0.1" force "com.google.android.gms:play-services-stats:16.0.1" force "com.google.android.gms:play-services-gcm:16.0.0" force "com.google.android.gms:play-services-ads:16.0.1" } }
implementation (project(':react-native-admob'), { exclude group: "com.google.android.gms" })
But have other error
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/ads/InterstitialAd;
UPDATE
add implementation ('com.google.android.gms:play-services-ads:16.+') { force = true; }
WORKS!
@IacoCesar Where should I put this configuration? Is it in the build.gradle
file?
@IacoCesar Where should I put this configuration? Is it in the
build.gradle
file?
Yes put the implementation in dependencies and configurations.all in upper of dependencies
@IacoCesar Where should I put this configuration? Is it in the
build.gradle
file?Yes put the implementation in dependencies and configurations.all in upper of dependencies
Sorry, I'm still confused about the gradle file. Am I missing something?
@IacoCesar Where should I put this configuration? Is it in the
build.gradle
file?Yes put the implementation in dependencies and configurations.all in upper of dependencies
Sorry, I'm still confused about the gradle file. Am I missing something?
build.gradle of the android/app
Same issue in "react-native": "0.59.9" "react": "16.8.3"
Same issue in "react-native": "0.59.9" "react": "16.8.3"
same issue
Go to react-native-admob under node-modules and change "import android.support.annotation.Nullable;" to import androidx.annotation.Nullable;
I fixed this issue on my own lib. Check this: https://github.com/sbugert/react-native-admob/issues/458
Solved adding
configurations.all { resolutionStrategy { force "com.google.android.gms:play-services-basement:16.0.1" force "com.google.android.gms:play-services-base:16.0.1" force "com.google.android.gms:play-services-stats:16.0.1" force "com.google.android.gms:play-services-gcm:16.0.0" force "com.google.android.gms:play-services-ads:16.0.1" } }
implementation (project(':react-native-admob'), { exclude group: "com.google.android.gms" })
But have other error
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/ads/InterstitialAd;
UPDATE
add
implementation ('com.google.android.gms:play-services-ads:16.+') { force = true; }
WORKS!
Anybody found a working solution
I've opened a PR to bring this library up to date with the latest version of React Native, and thus bringing support for CocoaPods and support for Android X: #472
The latest beta (v2.0.0-beta.6
) should work just fine with the latest version of React Native (and thus AndroidX)
The latest beta (
v2.0.0-beta.6
) should work just fine with the latest version of React Native (and thus AndroidX)
it's not working on 2.0.0-beta.6, I just initiated fresh react-native project, and first module I installed was react-native-admob.
I need a little bit more than just "it's not working". As you can see in the example project it is working, so I think it's a matter of configuration.
I switched from import android.support.annotation.Nullable;
to import androidx.annotation.Nullable;
on these files:
RNAdMobBannerViewManager.java
RNAdMobInterstitialAdModule.java
RNAdMobRewardedVideoAdModule.java
RNPublisherBannerViewManager.java
and it worked for me.
Note that you may also have top comment lines 92-95 on file :
RNAdMobRewardedVideoAdModule.java
// @Override
// public void onRewardedVideoCompleted() {
// sendEvent(EVENT_VIDEO_COMPLETED, null);
// }
I hope this helps.
I already have it like that but still throw error message.
have the same issue on m project. apply all the above but get nothing . same erroe
Stuck on this for about 7 hours and finally found the solution which is pretty simple. Just upgrade react-native-admob
to v2.0.0-beta.6 using
My react-native project config...
Install by using..
npm install react-native-admob@2.0.0-beta.6
First, create a Google Admob account and create you app in it and copy App_ID from GoogleAdmob > Apps > View All Apps > Copy AppID.
and then edit your AndroidManifest file. Project > android > app > src > AndroidManifest .
under
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="**YOUR_APP_ID**"/>
>
note: please add your app id in android.value
Now clean your build folder and rebuild the project everything will work fine.
Stuck on this for about 7 hours and finally found the solution which is pretty simple. Just upgrade
react-native-admob
to v2.0.0-beta.6 usingMy react-native project config...
- "react": "16.9.0",
- "react-native": "0.61.5",
- "react-native-admob": "^2.0.0-beta.6",
Install by using..
npm install react-native-admob@2.0.0-beta.6
First, create a Google Admob account and create you app in it and copy App_ID from GoogleAdmob > Apps > View All Apps > Copy AppID.
and then edit your AndroidManifest file. Project > android > app > src > AndroidManifest .
under tag insert
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="**YOUR_APP_ID**"/> >
note: please add your app id in android.value
Now clean your build folder and rebuild the project everything will work fine.
I've had another error after solving the previous one with this code. I had to add the following code in android/app/build.gradle for it to finally work: `android { defaultConfig { ... multiDexEnabled true } ... }
dependencies { implementation 'com.android.support:multidex:1.0.3' }`
Stuck on this for about 7 hours and finally found the solution which is pretty simple. Just upgrade
react-native-admob
to v2.0.0-beta.6 using My react-native project config...
- "react": "16.9.0",
- "react-native": "0.61.5",
- "react-native-admob": "^2.0.0-beta.6",
Install by using..
npm install react-native-admob@2.0.0-beta.6
First, create a Google Admob account and create you app in it and copy App_ID from GoogleAdmob > Apps > View All Apps > Copy AppID. and then edit your AndroidManifest file. Project > android > app > src > AndroidManifest . under tag insert
<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="**YOUR_APP_ID**"/> >
note: please add your app id in android.value Now clean your build folder and rebuild the project everything will work fine.
I've had another error after solving the previous one with this code. I had to add the following code in android/app/build.gradle for it to finally work: `android { defaultConfig { ... multiDexEnabled true } ... }
dependencies { implementation 'com.android.support:multidex:1.0.3' }`
Can attest to the multidex error being a common issue with this plugin. This workaround did the job. Thanks.
same issue, I implemented Admob using @react-native-firebase/app and @react-native-firebase/admob btw I would really like to use this library, Ad-components are such a better implementation
Update the file :- Build.gradle(react-native-admob)
// implementation 'com.google.android.gms:play-services-ads:+' // comment this line
implementation 'com.google.android.gms:play-services-ads:19.7.0' // add this line.
Update the file :- Build.gradle(react-native-admob)
// implementation 'com.google.android.gms:play-services-ads:+' // comment this line
implementation 'com.google.android.gms:play-services-ads:19.7.0' // add this line.
This, and other variations in the 'com.google.android.gms:play-services-ads:' implementation works, and I can build my app.
The problem is than then there is a great amount of "crashes" with this message:
java.lang.IllegalStateException
com.sbugert.rnadmob.ReactAdView.setAdSize
This is the Stack trace. Any idea on what to look for?
com.facebook.react.bridge.JSApplicationIllegalArgumentException:
at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateViewProp (ViewManagersPropertyCache.java:98)
at com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackViewManagerSetter.setProperty (ViewManagerPropertyUpdater.java:131)
at com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps (ViewManagerPropertyUpdater.java:51)
at com.facebook.react.uimanager.ViewManager.updateProperties (ViewManager.java:46)
at com.facebook.react.uimanager.NativeViewHierarchyManager.updateProperties (NativeViewHierarchyManager.java:139)
at com.facebook.react.uimanager.UIViewOperationQueue$UpdatePropertiesOperation.execute (UIViewOperationQueue.java:93)
at com.facebook.react.uimanager.UIViewOperationQueue$1.run (UIViewOperationQueue.java:844)
at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches (UIViewOperationQueue.java:952)
at com.facebook.react.uimanager.UIViewOperationQueue.access$2200 (UIViewOperationQueue.java:44)
at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded (UIViewOperationQueue.java:1012)
at com.facebook.react.uimanager.GuardedFrameCallback.doFrame (GuardedFrameCallback.java:29)
at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame (ReactChoreographer.java:172)
at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame (ChoreographerCompat.java:84)
at android.view.Choreographer$CallbackRecord.run (Choreographer.java:1090)
at android.view.Choreographer.doCallbacks (Choreographer.java:893)
at android.view.Choreographer.doFrame (Choreographer.java:809)
at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:1078)
at android.os.Handler.handleCallback (Handler.java:907)
at android.os.Handler.dispatchMessage (Handler.java:105)
at android.os.Looper.loop (Looper.java:216)
at android.app.ActivityThread.main (ActivityThread.java:7625)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:524)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:987)
Caused by: java.lang.reflect.InvocationTargetException:
at java.lang.reflect.Method.invoke (Native Method)
at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateViewProp (ViewManagersPropertyCache.java:83)
Caused by: java.lang.IllegalStateException:
at com.google.android.gms.internal.ads.zzzn.setAdSizes
at com.google.android.gms.ads.BaseAdView.setAdSize
at com.google.android.gms.ads.AdView.setAdSize
at com.sbugert.rnadmob.ReactAdView.setAdSize (RNAdMobBannerViewManager.java:158)
at com.sbugert.rnadmob.RNAdMobBannerViewManager.setPropAdSize (RNAdMobBannerViewManager.java:216)
Update the file :- Build.gradle(react-native-admob)
// implementation 'com.google.android.gms:play-services-ads:+' // comment this line
implementation 'com.google.android.gms:play-services-ads:19.7.0' // add this line.
This worked for me straight away!! Thanks to @omprakash8080
Has this issue been resolved? I try do like https://github.com/sbugert/react-native-admob/issues/448#issuecomment-814028706 or like https://github.com/sbugert/react-native-admob/issues/448#issuecomment-537659889, but them don't work for me, usage issue doesn't change.
"react": "17.0.1",
"react-native": "0.64.1",
"react-native-admob": "^2.0.0-beta.6",
Worst npm package i have ever seen. It's sad that there is no alternative
Worst npm package i have ever seen. It's sad that there is no alternative
It's open source, feel free to improve it yourself.
Go to react-native-admob under node-modules and change "import android.support.annotation.Nullable;" to import androidx.annotation.Nullable;
after using the above changes and adding these line in react-native-admob@2.0.0-beta.6 build.gradle file , I'm able to resolve this issue
implementation ('com.google.android.gms:play-services-ads:19.6.0') { force = true; }
getting annotation null error on newer reactnative version