Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | anbarasu chinna |
I am Integrating google AdMob sdk for one of my godot game. For reference I am using this link
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:
-
I Have installed android build templates by “Project” → “Install android build template” → “Install”. A template gets installed to “res://android/build”
-
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.
-
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.
-
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/… -
Enable Godot AdMob plugin - Under “Export” → “Android” → “options” -->“Plugins” → Godot AdMob set to true.
-
Enable Internet permissions - Under “Export” → “Android” → “options” permissions for “Access Network State” set to true and “Internet” set to true.
-
Editing manifest file - under android/build folder I have pasted the manifest with the my own Ad-Id.
-
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/java_godot_lib_jni.cpp:104:_initialize_java_modules() - Condition “!singletonClass” is true. Continuing.
I don’t know what mistake I have done. Can anyone help me? Thanks in advance.
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.
wbgyor | 2020-10-07 10:47
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.
anbarasu chinna | 2020-10-07 11:10
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!
Cayden Ho | 2020-10-11 20:44
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
anbarasu chinna | 2020-10-12 02:47
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.
- I used my own app-id in manifest.xml file.
- 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.
Cayden Ho | 2020-10-12 17:04
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.
anbarasu chinna | 2020-10-14 13:18