Skip to content
This repository has been archived by the owner on Mar 7, 2021. It is now read-only.

Error on initializing GodotAds #12

Open
distantforest1 opened this issue Jun 27, 2019 · 4 comments
Open

Error on initializing GodotAds #12

distantforest1 opened this issue Jun 27, 2019 · 4 comments

Comments

@distantforest1
Copy link

distantforest1 commented Jun 27, 2019

Hi I'm getting an error when I initialize godot ads:
platform/windows/os_windows.cpp:2532 - Condition ' !process_map->has(p_pid) ' is true. returned: FAILED

The code I have is very simple to see if I can get it working:

func _ready():
	godotAds = Engine.get_singleton("GodotAds")
	var instanceId = get_instance_id()
	if godotAds:		
		godotAds.init(instanceId) # it errors here

However I get the error shown above. Any idea whats going on here?

==Info==:
Compiled: Compiled from the 3.1 branch. x64
config.py settings

build = {
"admob"         : True,
"adcolony"      : False,
"chartboost"    : False,
"vungle"        : False,
"mopub"         : True,
"unity_ads"     : True,
"awesome_ads"   : False,
"appodeal"      : True,
"inmobi"        : False,
}

modules/GodotAds/libs: only has the unity-ads.aar (2.1 version)
Modules: "org/godotengine/godot/GodotAds" only so far
The godot project
GodotAdsTemplate.zip

@distantforest1
Copy link
Author

On closer inspection this is the error that appears on logcat:

06-27 17:22:43.069: E/AndroidRuntime(23960): FATAL EXCEPTION: GLThread 491
06-27 17:22:43.069: E/AndroidRuntime(23960): Process: com.pixelfruit.godotadstemplate, PID: 23960
06-27 17:22:43.069: E/AndroidRuntime(23960): android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
06-27 17:22:43.069: E/AndroidRuntime(23960): 	at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:8391)
06-27 17:22:43.069: E/AndroidRuntime(23960): 	at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:1393)
06-27 17:22:43.069: E/AndroidRuntime(23960): 	at android.view.View.requestLayout(View.java:23279)
06-27 17:22:43.069: E/AndroidRuntime(23960): 	at android.view.View.requestLayout(View.java:23279)
06-27 17:22:43.069: E/AndroidRuntime(23960): 	at android.view.View.requestLayout(View.java:23279)
06-27 17:22:43.069: E/AndroidRuntime(23960): 	at android.view.View.requestLayout(View.java:23279)
06-27 17:22:43.069: E/AndroidRuntime(23960): 	at android.view.ViewGroup.addView(ViewGroup.java:4867)
06-27 17:22:43.069: E/AndroidRuntime(23960): 	at android.view.ViewGroup.addView(ViewGroup.java:4809)
06-27 17:22:43.069: E/AndroidRuntime(23960): 	at android.view.ViewGroup.addView(ViewGroup.java:4782)
06-27 17:22:43.069: E/AndroidRuntime(23960): 	at org.godotengine.godot.GodotAds.init(GodotAds.java:43)
06-27 17:22:43.069: E/AndroidRuntime(23960): 	at org.godotengine.godot.GodotLib.step(Native Method)
06-27 17:22:43.069: E/AndroidRuntime(23960): 	at org.godotengine.godot.GodotView$Renderer.onDrawFrame(GodotView.java:710)
06-27 17:22:43.069: E/AndroidRuntime(23960): 	at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1575)
06-27 17:22:43.069: E/AndroidRuntime(23960): 	at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1270)
06-27 17:22:43.083: E/SensorManager(23960): unregisterListenerImpl callingApp: com.pixelfruit.godotadstemplate,callingPid:23960,callingUid:10365

Any idea whats going on?

@distantforest1
Copy link
Author

To fix the problem I replaced the init() in /android/GodotAds.java to


	public void init (final int p_script_id) {
		activity.runOnUiThread(new Runnable() {
			public void run() {
			adLayout = new RelativeLayout(activity);
			adLayout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
			((Godot)activity).layout.addView(adLayout);


			Utils.setScriptInstance(p_script_id);
			}
		});
	}

Adding a runnable on runOnUiThread. Turns out I don't need to initialize godotads in the end to get the ads to work so even if I got this working, I removed the init in the end..

@MatiasVME
Copy link
Contributor

The init gave me problems to. but I was able to use admob without init.

@zero2000
Copy link

zero2000 commented Sep 2, 2019

The init gave me problems to. but I was able to use admob without init.

hola, como es eso del init

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants