+1 vote

Just wondering if anyone is successfully using Mavhod's Admob module with 2.0.3. I followed the instructions from Github and I'm getting errors. It can't seem to find the Google ads API's.
Steps I performed, based on instructions here https://github.com/Mavhod/GodotAdmob

  1. Downloaded the admob zipped folder from github
  2. Extracted the admob sub-directory as \godot\modules\admob
  3. Moved the file \godot\modules\admob\android\GodotAdMob.java into \godot\platform\android\java\src\org\godotengine\godot
  4. From command-line with VCVARS set up: \godot\platform\android\java>gradlew.bat build

Some of the errors:

H:\dev\godot\src\godot-2.0.3-stable\platform\android\java>gradlew.bat build
:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:prepareDebugDependencies
:compileDebugAidl UP-TO-DATE
:compileDebugRenderscript UP-TO-DATE
:generateDebugBuildConfig UP-TO-DATE
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets UP-TO-DATE
:generateDebugResValues UP-TO-DATE
:generateDebugResources UP-TO-DATE
:mergeDebugResources UP-TO-DATE
:processDebugManifest UP-TO-DATE
:processDebugResources UP-TO-DATE
:generateDebugSources UP-TO-DATE
:processDebugJavaRes UP-TO-DATE
:compileDebugJava
H:\dev\godot\src\godot-2.0.3-stable\platform\android\java\src\org\godotengine\godot\GodotAdMob.java:
7: error: package com.google.android.gms.ads does not exist
import com.google.android.gms.ads.*;
^
H:\dev\godot\src\godot-2.0.3-stable\platform\android\java\src\org\godotengine\godot\GodotAdMob.java:
24: error: cannot find symbol
        private AdView          adView                  = null;
                ^
  symbol:   class AdView
  location: class GodotAdMob
H:\dev\godot\src\godot-2.0.3-stable\platform\android\java\src\org\godotengine\godot\GodotAdMob.java:
25: error: cannot find symbol
        private AdView          adViewW                 = null;
                ^
  symbol:   class AdView
  location: class GodotAdMob
H:\dev\godot\src\godot-2.0.3-stable\platform\android\java\src\org\godotengine\godot\GodotAdMob.java:
26: error: cannot find symbol
        private AdView          adViewH                 = null;
                ^
  symbol:   class AdView
  location: class GodotAdMob
in Engine by (714 points)

2 Answers

+1 vote
Best answer

Change #env.android_add_java_dir("android/java/src") to env.android_add_java_dir("android") in modules/Admob
And compile android first to update gradlew.bat

scons -j 4 platform=android target=release

You don't need 3rd step.

by (9,664 points)
selected by

Thanks. So I've additionally done:

  1. Move GodotAdmob.java back where it was originally
  2. Changed the code in that file as you said above
  3. Run gradlew.bat build again (I've built for Android already)

This successfully built java-release-unsigned.apk in build/outputs/apk/.

Then I loaded the demo project testAdmob and did:

  1. Added java-release-unsigned.apk to Custom Package/Release in Android Export options
    (enging.cfg already contains [android]
    modules="org/godotengine/godot/GodotAdMob"
    )
  2. Set up my release keystore info
  3. Set Signed ON
  4. Turned Debugging Enabled OFF
  5. Changed the code in main.xscn of the testAdmob demo to use my AdMob ad ID
  6. Checked permissions Access Network State and Internet (only)
  7. Exported and installed -> crash

Tried on a Nexus 6P running N beta and a Nexus 7 running 6.0.1

Any ideas? :)

No idea. I'm using my own admob module.
You need to see adb log what problem is.

ok thanks anyway for your time

me too, crashed when app ran.It so discouraged. :(
no idea.

I might try another admob module.

0 votes

DO you install google play services via SDK Manager? please check folders "yourandroidsdk\extras\google\google-play-services\libproject\google-play-serviceslib" exist. if not, the crash problem is here. download google-play-services from "https://dl-ssl.google.com/android/repository/google_play_services_6587000_r22.zip", and unzip to "yourandroid_sdk\extras\google", replace your google-play-services folder.

now recompile export template.

by (24 points)
edited by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.