+1 vote

I am Integrating google AdMob sdk for one of my godot game. For reference I am using this link

Admob Integration

Note : I am not familiar in Godot. My game is having only one scene. This is my first game and first AdMob integration.
These are the steps I followed in Godot 3.2.2 editor:

  1. I Have installed android build templates by "Project" --> "Install android build template" --> "Install". A template gets installed to “res://android/build”
  2. Set android sdk path by "Editor" --> "Editor Setting" --> "Export" --> "Android" under which I have configured adb, jarSigner, debug keystore and credentials. This step I can completed easily because I have good experience in android application development using android studio.
  3. Enable custom build option by "Project" --> "Export" --> "Selected android present" --> "Option" --> "Use custom build" set to true. after all this, I have confirmed everything work fine by installing application into my android device by pressing android icon at the top right corner of the editor.

  4. Adding AdMob plugin downloaded from Shin-Nil - I have downloaded release
    GodotAdmobPlugin-4.1.1.zip plugin under releases tab. I have extracted it. It comes up with two folder 1. admob-lib and 2. admob-plugin. I have pasted admob-lib directory inside res directory of my Godot project, so it will be looks like res://admob-lib/... and I pasted content of the admob-plugin into res://android/plugins/....

  5. Enable Godot AdMob plugin - Under "Export" --> "Android" --> "options" -->"Plugins" --> Godot AdMob set to true.

  6. Enable Internet permissions - Under "Export" --> "Android" --> "options" permissions for "Access Network State" set to true and "Internet" set to true.

  7. Editing manifest file - under android/build folder I have pasted the manifest with the my own Ad-Id.

  8. Setup android module - "Project setting" --> "General" --> "Android" --> "Module" set to "org/godotengine/godot/GodotAdMob"

From the source code of the repository I copied
"Godot-Android-Admob-Plugin/demo/main.tscn"
"Godot-Android-Admob-Plugin/demo/main.gd" and pasted under my project res:// directory. Also I have set main.tscn as my starting scene so that when I run app It start at first.

These are the set up I have made. Completed setting up.

Now I tried running my app in android device. I am getting following error.


adb logcat -s godot
--------- beginning of system
--------- beginning of crash
--------- beginning of main
10-07 12:17:23.832 30909 30951 I godot : Loading Android module: org/godotengine/godot/GodotAdMob
10-07 12:17:23.836 30909 30951 E godot : ERROR: Couldn't find singleton for class: org/godotengine/godot/GodotAdMob.
10-07 12:17:23.836 30909 30951 E godot : At: platform/android/javagodotlibjni.cpp:104:initializejavamodules() - Condition "!singletonClass" is true. Continuing.

I don't know what mistake I have done. Can anyone help me? Thanks in advance.

in Engine by (105 points)
recategorized by

In Step 7 it is not Ad id but App id which is needed to be added in the manifest. Step 8 is not required . Also use sample ad unit id and find out whether it works fine or not.

Actually I have used App-Id only not Ad-Id. Wrongly mentioned. But removing step 8 gives the good result, yes, it works now:) Superb. What is the difference? step 8 was added when I tried with the different documentation, forget to remove it.

I have the same question, and glad I found this to make a bit progress.
One quick question is, I'm new to Android develop, and still wonder where can I get my App-ID and how does it looks like? can anyone give me some hint? it would be more than appreciated!

Register your application in the AdMob console. It will give your app an unique App-Id. Use it in manifest.xml file. For more info

How to get App-Id in AdMob console

Thanks anbarasu chinna!

I've figured how APP-ID looks like, not long after my post, but new issues come up.

I can successfully get Shin-Nil's AdMob demo running on my mobile, but when I integrate Admob in my own app, adb logcat returns:

"AdMob Java Singleton not found. This plugin will only work on Android."

every time when I remote debug my app over USB.

1) I used my own app-id in manifest.xml file.
2) from Shin-Nil's demo Main.gd, I simplfied it to something like:

func _ready():
    loadAds()
# warning-ignore:return_value_discarded
    get_tree().connect("screen_resized", self, "_on_resize")
    admob.show_banner()

func loadAds() -> void:
    admob.load_banner()
    admob.load_interstitial()
    admob.load_rewarded_video()

so I can get banner shows up as soon as my app get ready.

still no luck to make it work on my own app.

For me every thing works fine now. What error you are getting. Post some detailed error log, so it will be helpful to fix issue.

2 Answers

0 votes

My app has also crashed, but when I removed step 8, it didn't crash anymore. But reward video is also not working (I have only reward ad set up). But the game is turning on ok.

by (18 points)
0 votes

In Godot 3.2.3 you can use binary precompiled modules for mediation networks: Applovin-MAX and Tapdaq. Both of them allow you use AdMob with their mediation.
All binary modules and adapters can be installed from NativeLib repository.
NativeLib addon you can find in AssetLib.
More info:
https://github.com/DrMoriarty/godot-applovin-max
https://github.com/DrMoriarty/godot-tapdaq
https://github.com/DrMoriarty/nativelib

by (206 points)
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.