admob-google-cordova: package com.google.android.gms.ads.purchase does not exist

After installing this plugin and try to build the phonegap app on a device with phonegap run android, I get the following error.

`Error: cmd: Command failed with exit code 1 Error output: [PATH]\platforms\android\src\com\appfeel\cordova\admob\AdMobAds.java:64: error: package com.google.android.gms.ads.purchase does not exist import com.google.android.gms.ads.purchase.InAppPurchase; ^ [PATH]\platforms\android\src\com\appfeel\cordova\admob\AdMobAdsAppPurchaseListener.java:33: error: package com.google.android.gms.ads.purchase does not exist import com.google.android.gms.ads.purchase.InAppPurchase; ^ [PATH]\platforms\android\src\com\appfeel\cordova\admob\AdMobAdsAppPurchaseListener.java:34: error: package com.google.android.gms.ads.purchase does not exist import com.google.android.gms.ads.purchase.InAppPurchaseListener; ^ [PATH]\platforms\android\src\com\appfeel\cordova\admob\AdMobAdsAppPurchaseListener.java:37: error: cannot find symbol public class AdMobAdsAppPurchaseListener implements InAppPurchaseListener { ^ symbol: class InAppPurchaseListener [PATH]\platforms\android\src\com\appfeel\cordova\admob\AdMobAdsAppPurchaseListener.java:40: error: cannot find symbol private SparseArray<InAppPurchase> purchases = new SparseArray<InAppPurchase>(); ^ symbol: class InAppPurchase location: class AdMobAdsAppPurchaseListener [PATH]\platforms\android\src\com\appfeel\cordova\admob\AdMobAdsAppPurchaseListener.java:47: error: cannot find symbol synchronized public void onInAppPurchaseRequested(final InAppPurchase inAppPurchase) { ^ symbol: class InAppPurchase location: class AdMobAdsAppPurchaseListener [PATH]\platforms\android\src\com\appfeel\cordova\admob\AdMobAdsAppPurchaseListener.java:60: error: cannot find symbol public InAppPurchase getPurchase(int purchaseId) { ^ symbol: class InAppPurchase location: class AdMobAdsAppPurchaseListener [PATH]\platforms\android\src\com\appfeel\cordova\admob\AdMobAds.java:626: error: cannot find symbol interstitialAd.setInAppPurchaseListener(inAppPurchaseListener); ^ symbol: method setInAppPurchaseListener(AdMobAdsAppPurchaseListener) location: variable interstitialAd of type InterstitialAd [PATH]\platforms\android\src\com\appfeel\cordova\admob\AdMobAds.java:705: error: cannot find symbol final InAppPurchase purchase = inAppPurchaseListener.getPurchase(purchaseId); ^ symbol: class InAppPurchase location: class AdMobAds [PATH]\platforms\android\src\com\appfeel\cordova\admob\AdMobAds.java:728: error: cannot find symbol final InAppPurchase purchase = inAppPurchaseListener.getPurchase(purchaseId); ^ symbol: class InAppPurchase location: class AdMobAds [PATH]\platforms\android\src\com\appfeel\cordova\admob\AdMobAdsAppPurchaseListener.java:40: error: cannot find symbol private SparseArray<InAppPurchase> purchases = new SparseArray<InAppPurchase>(); ^ symbol: class InAppPurchase location: class AdMobAdsAppPurchaseListener [PATH]\platforms\android\src\com\appfeel\cordova\admob\AdMobAdsAppPurchaseListener.java:46: error: method does not override or implement a method from a supertype @Override ^ Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: [PATH]\platforms\android\src\org\apache\cordova\file\AssetFilesystem.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 12 errors

FAILURE: Build failed with an exception.`

This happen on a windows machine. My installed plugins:

com-sarriaroman-photoviewer 1.1.10 “PhotoViewer” com.phonegap.plugins.nativesettingsopener 1.3.0 “Native settings” com.phonegap.plugins.OrientationLock 0.1 “OrientationLock” cordova-admob 4.1.16 “AdMob Google Ads + Tappx” cordova-connectivity-monitor 1.2.2 “Connectivity Monitoring” cordova-custom-config 3.1.4 “cordova-custom-config” cordova-plugin-app-event 1.2.0 “Application Events” cordova-plugin-app-version 0.1.9 “AppVersion” cordova-plugin-compat 1.1.0 “Compat” cordova-plugin-device 1.1.6 “Device” cordova-plugin-dialogs 1.3.3 “Notification” cordova-plugin-facebook4 1.9.1 “Facebook Connect” cordova-plugin-file 4.3.3 “File” cordova-plugin-firebase 0.1.21 “Google Firebase Plugin” cordova-plugin-google-analytics 1.8.2 “Google Universal Analytics Plugin” cordova-plugin-googleplus 5.1.1 “Google SignIn” cordova-plugin-inappbrowser 1.7.1 “InAppBrowser” cordova-plugin-native-keyboard 1.3.2 “Native Keyboard” cordova-plugin-network-information 1.3.3 “Network Information” cordova-plugin-screen-orientation 2.0.1 “Screen Orientation” cordova-plugin-splashscreen 4.0.3 “Splashscreen” cordova-plugin-statusbar 2.2.3 “StatusBar” cordova-plugin-whitelist 1.3.2 “Whitelist” cordova-plugin-x-socialsharing 5.1.8 “SocialSharing” cordova-universal-links-plugin 1.2.1 “Universal Links Plugin” es6-promise-plugin 4.1.0 “Promise”

Anyone an idea, why this happen and how to fix the issue?

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Reactions: 8
  • Comments: 16

Most upvoted comments

for me is was conflict between two plugins admob and google maps i fixed by open platform folder => projet.properties remove the “+” and give them all the same version i used 9.8.0 this is the result

target=android-23
android.library.reference.1=CordovaLib
cordova.system.library.1=com.google.android.gms:play-services-ads:9.8.0
cordova.system.library.2=com.google.android.gms:play-services-maps:9.8.0
cordova.system.library.3=com.google.android.gms:play-services-location:9.8.0
cordova.gradle.include.1=cordova-plugin-firebase/myapp231840-build.gradle
cordova.system.library.4=com.google.firebase:firebase-core:9.8.0
cordova.system.library.5=com.google.firebase:firebase-messaging:9.8.0
cordova.system.library.6=com.google.firebase:firebase-crash:9.8.0
cordova.system.library.7=com.google.firebase:firebase-config:9.8.0

and is work i hope this help someone (y)

I switched to cordova-plugin-admob-free… works for me,

I was able to resolve this problem using the method of yascasa, but I have no idea what the version number “9.8.0” represents…

My project.properties file:

target=android-25
android.library.reference.1=CordovaLib
cordova.system.library.1=com.google.android.gms:play-services-ads:9.8.0

I’m having this error: javascript:cordova.fireDocumentEvent('admob.banner.events.LOAD_FAIL',{"error":1,"reason":"Invalid request","adType":"banner"}); any suggestions?

Despite following the ionic docs for installing the admob plugin, I didn’t have cordova.system.library.1=com.google.android.gms:play-services-ads:9.8.0 in my project.properties at all.

After adding the above I was able to build android again.

@arnemorken For me, it did not work even if replacing + with 9.8.0