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

Fatal exception on Godot 3.3.2 #68

Open
GForceProductions opened this issue Jun 27, 2021 · 1 comment
Open

Fatal exception on Godot 3.3.2 #68

GForceProductions opened this issue Jun 27, 2021 · 1 comment

Comments

@GForceProductions
Copy link

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
Copy link

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
}

  •    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)
    
  •    connectionController = ConnectionController(godot.getActivity() as Activity, signInOptions)
    
  •    signInController = SignInController(godot.getActivity() as Activity, this, connectionController)
    
  •    achievementsController = AchievementsController(godot.getActivity() as Activity, this, connectionController)
    
  •    leaderboardsController = LeaderboardsController(godot.getActivity() as Activity, this, connectionController)
    
  •    eventsController = EventsController(godot.getActivity() as Activity, this, connectionController)
    
  •    playerStatsController = PlayerStatsController(godot.getActivity() as Activity, this, connectionController)
    
  •    playerInfoController = PlayerInfoController(godot.getActivity() as Activity, this, connectionController)
    
  •    savedGamesController = SavedGamesController(godot.getActivity() as Activity, this, connectionController)
    
  •    googleSignInClient = GoogleSignIn.getClient(godot as Activity, signInOptions)
    
  •    googleSignInClient = GoogleSignIn.getClient(godot.getActivity() as Activity, signInOptions)
    
       runOnUiThread {
           signInController.setShowPopups(enablePopups)
    

@@ -435,4 +435,4 @@ class PlayGameServicesGodot(godot: Godot) : GodotPlugin(godot), AchievementsList
override fun onPlayerInfoLoadingFailed() {
emitSignal(SIGNAL_PLAYER_INFO_LOADED_FAILED.name)
}
-}

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 {

  • compileOnly project(":godot-lib.3.2.2.stable.release")
  • compileOnly project(":godot-lib.3.4.3.stable.release")
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'com.google.android.gms:play-services-games:20.0.1'
    implementation 'com.google.android.gms:play-services-auth:18.1.0'

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

2 participants