appfeel / admob-google-cordova

AdMob ads Cordova/Phonegap/Intel XDK plugin for Android iPhone with latest SDK's
MIT License
133 stars 127 forks source link

package com.google.android.gms.ads.purchase does not exist #82

Open wo-github opened 6 years ago

wo-github commented 6 years ago

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 purchases = new SparseArray(); ^ 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 purchases = new SparseArray(); ^ 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?

amokrunner commented 6 years ago

FWIW, I am seeing the same issue (phonegap build)

WilliamMarker commented 6 years ago

FWIW... same issue using... cordova run android

hamzahppa commented 6 years ago

Same issue here with ionic. Any solution?

mallikvarma commented 6 years ago

I am also having the same issue. any body has a solution for it ?

yascasa commented 6 years ago

the same issue , i'm stuck for 7 days now without any solutions.

mallikvarma commented 6 years ago

moved to admob-pro plugin and that works fine.

jpipher commented 6 years ago

Anyone have a solution to this yet, aside from switching to admob-pro? I am having the same issue

tscislo commented 6 years ago

Any solution?

yascasa commented 6 years ago

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)

iampinheirosamuel commented 6 years ago

Thanks for your contributions but is there any other solution asides those listed above?

arnemorken commented 6 years ago

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
shahidkarimi commented 6 years ago

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

WilliamMarker commented 6 years ago

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

andreescocard commented 6 years ago

Same here

justenjoi commented 6 years ago

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.

baabakk commented 6 years ago

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