PGSGP icon indicating copy to clipboard operation
PGSGP copied to clipboard

Godot cannot be cast to android.app.Activity

Open SanderVanhove opened this issue 3 years ago • 7 comments

Godot version: 3.3.2

When I call play_games_services.init(false) I get this error in my logcat:

AndroidRuntime: Process: com.sandervanhove.bouncybox, PID: 27870
AndroidRuntime: java.lang.ClassCastException: org.godotengine.godot.Godot cannot be cast to android.app.Activity
AndroidRuntime:        at io.cgisca.godot.gpgs.PlayGameServicesGodot.initialize(PlayGameServicesGodot.kt:185)
AndroidRuntime:        at io.cgisca.godot.gpgs.PlayGameServicesGodot.init(PlayGameServicesGodot.kt:168)
AndroidRuntime:        at org.godotengine.godot.GodotLib.step(Native Method)
AndroidRuntime:        at org.godotengine.godot.GodotRenderer.onDrawFrame(GodotRenderer.java:60)
AndroidRuntime:        at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1582)
AndroidRuntime:        at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1281)

Maybe this is related to https://github.com/godotengine/godot/issues/47198.

SanderVanhove avatar Jun 07 '21 15:06 SanderVanhove

Probably these lines should be updated:

https://github.com/cgisca/PGSGP/blob/8a47c95620c58c4d357ed50aef2e2c722a875050/app/src/main/java/io/cgisca/godot/gpgs/PlayGameServicesGodot.kt#L185-L194

SanderVanhove avatar Jun 07 '21 15:06 SanderVanhove

I get this same error, How to update these lines? it is not on my project.

Clooloo avatar Jun 21 '21 02:06 Clooloo

So what I did was cloned the repo, altered the line, made it depend on Godot 3.3.2 and rebuild the plugin. That did the trick. But it is in no shape to be made in a PR I'm afraid because I didn't really know what I was doing.

SanderVanhove avatar Jun 28 '21 14:06 SanderVanhove

Hi @SanderVanhove

Would it be possible for you to create a branch(of the changes you made) and share here. Seems like lot of people are facing the same issue.

vipulbehl avatar Jul 10 '21 06:07 vipulbehl

Facing the same issue here...would appreciate some assistance.

HardcoreMuse avatar Jul 15 '21 23:07 HardcoreMuse

Use https://github.com/cgisca/PGSGP/pull/63

This PR has support for 3.3.2

vipulbehl avatar Jul 16 '21 03:07 vipulbehl

Whoops sorry for reacting so late 😅 Yeah that PR seems to implement the right changes.

SanderVanhove avatar Jul 17 '21 10:07 SanderVanhove