Admob plugins doesn't work... AGAIN!


#1

And It happen once again. Last time work. now it doesn’t!
last time, Admob pro doesn’t work so I switch to other admob ads plugins. Now that one doesn’t work too. anyone have an alternate plugins that work with construct 2’s default admob plugins?
and here’s the log. if you know what I did wrong, please tell me how to fix it
COMPILER ERROR:

/workspace/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project ‘android’.

Could not resolve all dependencies for configuration ‘:_armv7DebugApkCopy’.
Could not find com.google.android.gms:play-services-ads:15.0.1.
Searched in the following locations:
file:/opt/cocoon_compiler/workspace/production/data/sdks/android-sdks-linux/extras/google/m2repository/com/google/android/gms/play-services-ads/15.0.1/play-services-ads-15.0.1.pom
file:/opt/cocoon_compiler/workspace/production/data/sdks/android-sdks-linux/extras/google/m2repository/com/google/android/gms/play-services-ads/15.0.1/play-services-ads-15.0.1.jar
file:/workspace/platforms/android/sdk-manager/com/google/android/gms/play-services-ads/15.0.1/play-services-ads-15.0.1.jar
file:/opt/cocoon_compiler/workspace/production/data/sdks/android-sdks-linux/extras/android/m2repository/com/google/android/gms/play-services-ads/15.0.1/play-services-ads-15.0.1.pom
file:/opt/cocoon_compiler/workspace/production/data/sdks/android-sdks-linux/extras/android/m2repository/com/google/android/gms/play-services-ads/15.0.1/play-services-ads-15.0.1.jar
file:/workspace/platforms/android/sdk-manager/com/google/android/gms/play-services-ads/15.0.1/play-services-ads-15.0.1.jar
Required by:
project :

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

CORDOVA LOG:

e[36m20181202T110245 [DEBUG] AndroidBuilder -e[39m [prepare] cordova restore platforms
e[36m20181202T110245 [DEBUG] AndroidBuilder -e[39m [prepare] adding engine android@6.2.3
Subproject Path: CordovaLib
Subproject Path: CordovaLib
Subproject Path: CordovaLib
(node:20226) [DEP0016] DeprecationWarning: ‘root’ is deprecated, use ‘global’
e[36m20181202T110309 [DEBUG] AndroidBuilder -e[39m [prepare] cordova restore plugins
e[36m20181202T110309 [DEBUG] AndroidBuilder -e[39m [prepare] adding plugin cocoon-plugin-ads-android-admob@*
e[36m20181202T110309 [DEBUG] AndroidBuilder -e[39m [prepare] adding plugin com.ludei.defaultres.android@1.0.1
e[36m20181202T110309 [DEBUG] AndroidBuilder -e[39m [prepare] adding plugin com.ludei.installlocation.android@1.0.0
e[36m20181202T110309 [DEBUG] AndroidBuilder -e[39m [prepare] adding plugin com.ludei.usericon.android@1.0.1
e[36m20181202T110309 [DEBUG] AndroidBuilder -e[39m [prepare] adding plugin com.ludei.usersplash.android@1.0.2
e[36m20181202T110309 [DEBUG] AndroidBuilder -e[39m [prepare] adding plugin com.ludei.webviewplus.ios@1.1.4
e[36m20181202T110309 [DEBUG] AndroidBuilder -e[39m [prepare] adding plugin cordova-plugin-crosswalk-webview@*
e[36m20181202T110309 [DEBUG] AndroidBuilder -e[39m [prepare] adding plugin cordova-plugin-inappbrowser@*
e[36m20181202T110309 [DEBUG] AndroidBuilder -e[39m [prepare] adding plugin cordova-plugin-whitelist@*
e[36m20181202T110311 [DEBUG] AndroidBuilder -e[39m [build]
Warning: File /.android/repositories.cfg could not be loaded.
e[36m20181202T110313 [DEBUG] AndroidBuilder -e[39m [build] create certs folder
e[36m20181202T110313 [DEBUG] AndroidBuilder -e[39m [build] keystore
e[36m20181202T110313 [DEBUG] AndroidBuilder -e[39m [build] create build.json
e[36m20181202T110313 [DEBUG] AndroidBuilder -e[39m [build] call cordova
ANDROID_HOME=/opt/cocoon_compiler/workspace/production/data/sdks/android-sdks-linux
JAVA_HOME=/usr/lib/jvm/default-java
Subproject Path: CordovaLib
null
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_7fcfhp3krxtq4au62ki016g50.run(/workspace/platforms/android/build.gradle:138)
org.xwalk:xwalk_core_library:23+
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
Incremental java compilation is an incubating feature.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project ‘android’.

Could not resolve all dependencies for configuration ‘:_armv7DebugApkCopy’.
Could not find com.google.android.gms:play-services-ads:15.0.1.
Searched in the following locations:
file:/opt/cocoon_compiler/workspace/production/data/sdks/android-sdks-linux/extras/google/m2repository/com/google/android/gms/play-services-ads/15.0.1/play-services-ads-15.0.1.pom
file:/opt/cocoon_compiler/workspace/production/data/sdks/android-sdks-linux/extras/google/m2repository/com/google/android/gms/play-services-ads/15.0.1/play-services-ads-15.0.1.jar
file:/workspace/platforms/android/sdk-manager/com/google/android/gms/play-services-ads/15.0.1/play-services-ads-15.0.1.jar
file:/opt/cocoon_compiler/workspace/production/data/sdks/android-sdks-linux/extras/android/m2repository/com/google/android/gms/play-services-ads/15.0.1/play-services-ads-15.0.1.pom
file:/opt/cocoon_compiler/workspace/production/data/sdks/android-sdks-linux/extras/android/m2repository/com/google/android/gms/play-services-ads/15.0.1/play-services-ads-15.0.1.jar
file:/workspace/platforms/android/sdk-manager/com/google/android/gms/play-services-ads/15.0.1/play-services-ads-15.0.1.jar
Required by:
project :

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2.088 secs
e[91m20181202T110320 [ERROR] AndroidBuilder -e[39m { Error: /workspace/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project ‘android’.

Could not resolve all dependencies for configuration ‘:_armv7DebugApkCopy’.
Could not find com.google.android.gms:play-services-ads:15.0.1.
Searched in the following locations:
file:/opt/cocoon_compiler/workspace/production/data/sdks/android-sdks-linux/extras/google/m2repository/com/google/android/gms/play-services-ads/15.0.1/play-services-ads-15.0.1.pom
file:/opt/cocoon_compiler/workspace/production/data/sdks/android-sdks-linux/extras/google/m2repository/com/google/android/gms/play-services-ads/15.0.1/play-services-ads-15.0.1.jar
file:/workspace/platforms/android/sdk-manager/com/google/android/gms/play-services-ads/15.0.1/play-services-ads-15.0.1.jar
file:/opt/cocoon_compiler/workspace/production/data/sdks/android-sdks-linux/extras/android/m2repository/com/google/android/gms/play-services-ads/15.0.1/play-services-ads-15.0.1.pom
file:/opt/cocoon_compiler/workspace/production/data/sdks/android-sdks-linux/extras/android/m2repository/com/google/android/gms/play-services-ads/15.0.1/play-services-ads-15.0.1.jar
file:/workspace/platforms/android/sdk-manager/com/google/android/gms/play-services-ads/15.0.1/play-services-ads-15.0.1.jar
Required by:
project :

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    at ChildProcess.whenDone (/workspace/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
    at ChildProcess.emit (events.js:182:13)
    at maybeClose (internal/child_process.js:962:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
    stderr:
    ‘\nFAILURE: Build failed with an exception.\n\n* What went wrong:\nA problem occurred configuring root project ‘android’.\n> Could not resolve all dependencies for configuration ‘:_armv7DebugApkCopy’.\n > Could not find com.google.android.gms:play-services-ads:15.0.1.\n Searched in the following locations:\n file:/opt/cocoon_compiler/workspace/production/data/sdks/android-sdks-linux/extras/google/m2repository/com/google/android/gms/play-services-ads/15.0.1/play-services-ads-15.0.1.pom\n file:/opt/cocoon_compiler/workspace/production/data/sdks/android-sdks-linux/extras/google/m2repository/com/google/android/gms/play-services-ads/15.0.1/play-services-ads-15.0.1.jar\n file:/workspace/platforms/android/sdk-manager/com/google/android/gms/play-services-ads/15.0.1/play-services-ads-15.0.1.jar\n file:/opt/cocoon_compiler/workspace/production/data/sdks/android-sdks-linux/extras/android/m2repository/com/google/android/gms/play-services-ads/15.0.1/play-services-ads-15.0.1.pom\n file:/opt/cocoon_compiler/workspace/production/data/sdks/android-sdks-linux/extras/android/m2repository/com/google/android/gms/play-services-ads/15.0.1/play-services-ads-15.0.1.jar\n file:/workspace/platforms/android/sdk-manager/com/google/android/gms/play-services-ads/15.0.1/play-services-ads-15.0.1.jar\n Required by:\n project :\n\n* Try:\nRun with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.\n’,
    stdout:
    ‘null\nThe Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.\n\tat build_7fcfhp3krxtq4au62ki016g50.run(/workspace/platforms/android/build.gradle:138)\norg.xwalk:xwalk_core_library:23+\nThe JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.\nIncremental java compilation is an incubating feature.\nThe TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.\n\nBUILD FAILED\n\nTotal time: 2.088 secs\n’,
    code: 1 }

#2

Same problem. Any help?


#3

You can use the following, but I’m not sure it’s Construct 2-compatible


The AdMob plugins had been having problems lately, but I have a solution that can work on the latest Cocoon version, but it involves using a different AdMob plugin within your Config.xml: <plugin name=“admob” spec="*"/>.

Then, add the following within the “deviceready” event:

admob.initAdmob(bannerAdUnitVar, interstitialAdUnitVar);
		
//

//show in ad receive event fun need add receive listener:
document.addEventListener(admob.Event.onInterstitialReceive, onInterstitialReceive, false);
		
document.addEventListener(admob.Event.onAdmobBannerDismiss, onAdmobEvent, false);
document.addEventListener(admob.Event.onAdmobBannerFailedReceive, onAdmobEvent, false);
document.addEventListener(admob.Event.onAdmobBannerLeaveApplication, onAdmobEvent, false);
document.addEventListener(admob.Event.onAdmobBannerPresent, onAdmobEvent, false);
document.addEventListener(admob.Event.onAdmobBannerReceive, onAdmobEvent, false);
document.addEventListener(admob.Event.onAdmobInterstitialDismiss, function(){
	//You can add any function here.
}, false);
document.addEventListener(admob.Event.onAdmobInterstitialFailedReceive, function(){
	//You can add any function here.
}, false);
document.addEventListener(admob.Event.onAdmobInterstitialLeaveApplication, onAdmobEvent, false);
document.addEventListener(admob.Event.onAdmobInterstitialPresent, function(){
	//You can add any function here.
}, false);
document.addEventListener(admob.Event.onAdmobInterstitialReceive, onAdmobEvent, false);

Now, to preload your ads, call “admob.cacheInterstitial();” for Interstitial Ads, then “admob.showInterstitial();” to launch it.

Hope this helps, while we hope Ludei and even CranBerry will ever fix their own AdMob plugins.