nativescript-admob
nativescript-admob copied to clipboard
TypeError: Cannot read property 'getRewardedVideoAdInstance' of undefined
Calling preloadRewardedVideoAd fails with errors:
JS: Error in admob.preloadRewardedVideoAd: TypeError: Cannot read property 'getRewardedVideoAdInstance' of undefined
JS: TypeError: Cannot read property 'getRewardedVideoAdInstance' of undefined
I have no Idea how to fix this. Can anyone help?
That's this line:
https://github.com/EddyVerbruggen/nativescript-admob/blob/677e83898d5640e60cd3ba7b5131c195362f3f6b/src/admob.android.js#L269
I think you Play Services version on your build machine may be outdated - can you update your SDKs and play repo through Android Studio?
Hi, found what was problem. I haven't added to MobileAds to gradle dependencies
dependencies { compile 'com.google.android.gms:play-services-ads:17.1.2' }
Maybe this should be added to readme?
Hi! That should not be necessary. I wonder if it's caused by this change, where compile
(which you have as well) changed to implementation
.
What happens if you change compile
to implementation
and remove the platforms/android folder, and build again?
OK, I can confirm that it works fine after cleaning project and changing compile
to implementation
.
OK, so why doesn't the plugin work for you without you having to add that line? 🤔I mean, a similar line is here: https://github.com/EddyVerbruggen/nativescript-admob/blob/402c9ffc63a9e8a8972d55697a3e665e27da8a99/src/platforms/android/include.gradle#L11
Does your App_Resources/Android/app.gradle file perhaps specify a play services version (that's too low)?