godot
godot copied to clipboard
ProjectSetting.save_custom("user:://override.cfg") with android plugin will cause USER ERROR: Cannot get class 'JNISingleton'.
Tested versions
4.3 stable
System information
Android
Issue description
I'm trying to set game resolution at runtime, save it via ProjectSetting.save_custom and read it back. And I find no matter how I change the ProjectSetting, when I get the resolution, the value remains as initial.
So I tried to print the content of override.cfg, the new resolution is set, but accidentally, I noticed there is an error popup which might break the loading of override.cfg.
Here is the steps I did.
Add an android plugin to project, set Application/Config/ProjectSettingsOverride to "user://override.cfg", and invoke ProjectSetting.save_custom("user://override.cfg"). Following setction will be added to the top of override.cfg
config_version=5
AndroidPlugin=Object(JNISingleton,"script":null)
And error occurred states
USER ERROR: Cannot get class 'JNISingleton'.
at: _instantiate_internal (core/object/class_db.cpp:515)
USER ERROR: Error parsing user://override.cfg at line 10: Can't instantiate Object() of type: JNISingleton File might be corrupted.
at: _load_settings_text (core/config/project_settings.cpp:777)
Steps to reproduce
- open the MRP project
- install android build template.
- plug android phone
- one click deploy the game to android
- click Set High Res button
- quit and kill game
- restart the game
- see the log from logcat
Minimal reproduction project (MRP)
Any response to this issue? or do I have to provide more info or something? This issue blocks our game to use custom project setting to adjust resolution and render quality stuff.
@AllenDang I cannot reproduce this issue, i have tried with both v1 and v2 plugin.
@syntaxerror247 I've managed to create a MRP to repo this issue, see attached.
Steps to repo:
- open the project
- install android build template.
- plug android phone
- one click deploy the game to andoird
- click Set High Res
- quit and kill game
- restart the game
- see the log from logcat
The error message will popup says
USER ERROR: Cannot get class 'JNISingleton'.
at: _instantiate_internal (core/object/class_db.cpp:515)
USER ERROR: Error parsing user://override.cfg at line 10: Can't instantiate Object() of type: JNISingleton File might be
at: _load_settings_text (core/config/project_settings.cpp:777)
any update on this?
I can now reproduce this in version 4.3, but it doesn't occur in the master branch. There were some recent updates related to JNISingleton, and it seems the issue has already been fixed. You can check 4.4 dev3 release. CC @m4gr3d @dsnopek
@AllenDang @syntaxerror247 This issue should have been resolved via https://github.com/godotengine/godot/pull/96624/files#diff-cad096f9d4cb422b6efe335ccb4384e14f7892e414e6517d939a61e0b698d980.
We may be able to backport the specific changes to godot_plugin_jni to the 4.3 release. Unless @AllenDang you're okay with waiting for the next 4.4 release (scheduled for early next year).
@m4gr3d I can wait for the next 4.4 release, thanks :)
Sounds good! In that case, I'll close this task as completed.
Please also give a try to the 4.4 dev releases to ensure your issue is fully resolved.