cgisca / PGSGP

Play Games Services plugin for Godot Game Engine - Android
MIT License
219 stars 60 forks source link

Fatal exception on Godot 3.3.2 #68

Open GForceProductions opened 3 years ago

GForceProductions commented 3 years ago

The plug-in works perfectly when exporting on Godot 3.2.3

Now when using Godot 3.3.2, the following issue arises, from logcat:


    Process: com.gforceproductions.bounzyx, PID: 16471
    java.lang.ClassCastException: org.godotengine.godot.Godot cannot be cast to android.app.Activity
        at io.cgisca.godot.gpgs.PlayGameServicesGodot.initialize(PlayGameServicesGodot.kt:185)
        at io.cgisca.godot.gpgs.PlayGameServicesGodot.initWithSavedGames(PlayGameServicesGodot.kt:172)
        at org.godotengine.godot.GodotLib.step(Native Method)
        at org.godotengine.godot.GodotRenderer.onDrawFrame(GodotRenderer.java:60)
        at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1575)
        at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1270)```
mygarfieldlee commented 2 years ago

It's because godot changed Godot.java from FragmentActivity into Fragment class since 3.3. The script need to be updated, and you need to build against 3.4 or 3.3 godot aar lib

--- a/app/src/main/java/io/cgisca/godot/gpgs/PlayGameServicesGodot.kt +++ b/app/src/main/java/io/cgisca/godot/gpgs/PlayGameServicesGodot.kt @@ -182,16 +182,16 @@ class PlayGameServicesGodot(godot: Godot) : GodotPlugin(godot), AchievementsList GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN }

diff --git a/settings.gradle b/settings.gradle index 4d58af6..43137ca 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -include ':app', ':godot-lib.3.2.2.stable.release' \ No newline at end of file +include ':app', ':godot-lib.3.4.3.stable.release'

--- a/app/build.gradle +++ b/app/build.gradle @@ -34,7 +34,7 @@ android { }

dependencies {