question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] has_singleton("AdMob") fails in sample project

See original GitHub issue

Describe the bug I’m attempting to run the sample project on an LG G3 Android. The project works and deploys correctly, but none of the buttons seemed to be doing anything for me. After some digging, I’ve made the following modification to admob_api/AdMob.gd’s ready function:

func _ready():
	if admob_enabled:
		if (Engine.has_singleton("AdMob")):
			_admob_singleton = Engine.get_singleton("AdMob")
			#_admob_singleton = self
			print("admob singleton: %s" % _admob_singleton)
			_initialize()
			# warning-ignore:return_value_discarded
			get_tree().connect("screen_resized", self, "_on_get_tree_resized")
		else:
			print("Singleton check fails")

And when debugging, it prints “Singleton check fails”. I’m a little confused about the fact that AdMob.tscn is a Autoload Singleton that gets checked, when the check is already being called from within AdMob.gd, which I think is the script for AdMob.tscn.

Regardless, am I missing something setup wise? I’ve gone through the install instructions, setup Android custom build and everything seems alright from that standpoint, it’s just this Singleton loading I can’t get working.

To Reproduce Steps to reproduce the behavior: Just run the example project with the modifications listed above.

Expected behavior Expected AdMob singleton to load, and ad callbacks on button presses.

Screenshots Don’t believe any are necessary just yet.

Smartphone (please complete the following information):

  • Device: LG G3
  • OS: Android 5.0.2
  • Godot Version: 3.2.3

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sjhennioncommented, Jan 5, 2021

@gustavottc Got it working. Pulled the latest down from the repo, went through the configuration steps again. One thing I definitely had wrong was I was using the App Unit Id rather than the App Id, although it’s very possible I had something else incorrect as well, but it’s working now!

Thanks for the help, liking what I’m seeing so far here!

1reaction
sjhennioncommented, Jan 5, 2021

@gustavottc I had gone through everything in the first link, and it was the example project I was trying to get working. I only modified AdMob.api because I was trying to debug my issue.

Your apk does work for me, so I’m going to go through everything again just to make sure I didn’t miss a step.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common reasons for ads not showing - Google AdMob Help
Sample apps show how to use the Google Mobile Ads SDK to place ads into apps. Ads won't show if you haven't integrated...
Read more >
Integrate Google Admob | Ads not showing Problem Fixed
In this video I will show you how to add google admob in unity and how to fix ads not showing problem.I will...
Read more >
Ad Load Errors | Android - Google Developers
When an ad fails to load, there is always a callback that is called which provides a LoadAdError object. // Gets the domain...
Read more >
Admob implementation Error - android - Stack Overflow
I solved this by creating a new library project used by my app. For this library project I have set the build target...
Read more >
Domain=com.google.ads Code=1 "Request Error
But it can't show the ad and print the log "Error Domain=com.google.ads ... your Native Express Ads, or a sample project that can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found