Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Godot cannot be cast to android.app.Activity #65

Open
SanderVanhove opened this issue Jun 7, 2021 · 7 comments
Open

Godot cannot be cast to android.app.Activity #65

SanderVanhove opened this issue Jun 7, 2021 · 7 comments

Comments

@SanderVanhove
Copy link

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 godotengine/godot#47198.

@SanderVanhove
Copy link
Author

Probably these lines should be updated:

connectionController = ConnectionController(godot as Activity, signInOptions)
signInController = SignInController(godot as Activity, this, connectionController)
achievementsController = AchievementsController(godot as Activity, this, connectionController)
leaderboardsController = LeaderboardsController(godot as Activity, this, connectionController)
eventsController = EventsController(godot as Activity, this, connectionController)
playerStatsController = PlayerStatsController(godot as Activity, this, connectionController)
playerInfoController = PlayerInfoController(godot as Activity, this, connectionController)
savedGamesController = SavedGamesController(godot as Activity, this, connectionController)
googleSignInClient = GoogleSignIn.getClient(godot as Activity, signInOptions)

@Clooloo
Copy link

Clooloo commented Jun 21, 2021

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

@SanderVanhove
Copy link
Author

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.

@vipulbehl
Copy link

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.

@HardcoreMuse
Copy link

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

@vipulbehl
Copy link

Use
#63

This PR has support for 3.3.2

@SanderVanhove
Copy link
Author

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

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

No branches or pull requests

4 participants