cgisca / PGSGP

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

Didn't find class "org/godotengine/godot/PlayGameServices" #15

Closed tx350z closed 4 years ago

tx350z commented 4 years ago

Thank you for the hard work building this plug-in.

Tried several times to implement the plug-in in my app. Logcat reports singleton PlayGameServices is not found. Verified "org/godotengine/godot/PlayGameServices" is in the modules list. Compared the project settings with the Demo included in the zip and can't find any differences. I tried both the PlayGamesSvcsGP-master and the PGSGP-1.2.0 versions with the same result.

Reviewed APK class.dex and did not find PlayGameServices listed. All the other the plug-in classes ARE listed in class.dex. Only PlayGameServices is missing.

Logcat out put is below (my game package names have been obfuscated). Any suggestions?

2020-04-08 08:44:26.778 13231-13255/? E/godot: ERROR: Couldn't find singleton for class: org/godotengine/godot/PlayGameServices. 2020-04-08 08:44:26.778 13231-13255/? E/godot: At: platform/android/java_godot_lib_jni.cpp:691:_initialize_java_modules() - Condition "!singletonClass" is true. Continuing. 2020-04-08 08:44:26.781 13231-13255/? E/AndroidRuntime: FATAL EXCEPTION: GLThread 12004 Process: xxxxxxx.games.xxxx, PID: 13231 java.lang.ClassNotFoundException: Didn't find class "org/godotengine/godot/PlayGameServices" on path: DexPathList[[zip file "/data/app/xxxxxxx.games.xxxx-CxyZsnOEOvQSouq0KSVcNA==/base.apk"],nativeLibraryDirectories=[/data/app/xxxxxxx.games.xxxx-CxyZsnOEOvQSouq0KSVcNA==/lib/arm, /data/app/xxxxxxx.games.xxxx-CxyZsnOEOvQSouq0KSVcNA==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at org.godotengine.godot.GodotLib.setup(Native Method) at org.godotengine.godot.Godot$2.run(Godot.java:325) at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1500) at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1270)

cgisca commented 4 years ago

Hi, have you followed the setup steps from README.md file?

Have you added org/godotengine/godot/PlayGameServices as described below: In Godot Engine, go to Project -> Project Settings. Then on the tab General go to the Android section, and fill the Modules part with org/godotengine/godot/PlayGameServices

Also check that in the Project > Export dialog, Custom Build is enabled

tx350z commented 4 years ago

I did follow the instructions. I managed to solve the problem in the following way: 1) copy android-pgs-plugin into the android folder 2) put the GPGS app ID in android-pgs-plugin/res/ids.xml 3) Delete folder android/build 4) Reinstall Android Build Template 5) Add these two lines to android/build/gradle.properties android.useAndroidX=true android.enableJetifier=true 6) Do an Android export - all is good and the singleton class appears in the APK classes.dex

It seems the Android Build Template has to be reinstalled after the plugin folder in the android folder. But can't be to export until the gradle.properties are changed. There needs to be an option to rebuild the template without deleting the android/build directory. But that's not a problem with your plugin.

Closing this issue.

Thanks again!