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 User Error running C# project on Android #88160

Closed
zmertens opened this issue Feb 9, 2024 · 5 comments · Fixed by #88692
Closed

Godot User Error running C# project on Android #88160

zmertens opened this issue Feb 9, 2024 · 5 comments · Fixed by #88692

Comments

@zmertens
Copy link

zmertens commented Feb 9, 2024

Tested versions

  • Reproducible in Godot 4.3 on v4.3.dev.mono.custom_build [4e990cd].
  • Could open but not build Godot project on v4.2.1.stable.mono.official [b09f793] (I think it is a separate error since I was able to build on a later version like Godot 4.3).

System information

Ubuntu 22.04 - v4.3.dev.mono.custom_build [4e990cd] - Mobile - Rendering failure

Issue description

Godot v4.3.dev.mono (4e990cd) - Ubuntu 22.04.3 LTS 22.04 - X11 - Vulkan (Mobile) - dedicated NVIDIA GeForce GTX 970 (nvidia; 535.154.05) - AMD Ryzen 7 3700X 8-Core Processor (16 Threads)

I am exporting a C# project on Godot 4.3 mono to Android and the APK builds correctly, but the app stalls with black screen on the device after running adb install MyApp.apk. Testing it from the editor on Ubuntu it works fine.

02-09 13:32:16.512 23342 23394 E godot   : USER ERROR: Failed loading scene: res://shade_scene.tscn.
02-09 13:32:16.512 23342 23394 E godot   :    at: start (main/main.cpp:3736)
02-09 13:32:16.512 23342 23394 E godot   : USER ERROR: Condition "default_certs != nullptr" is true.
02-09 13:32:16.512 23342 23394 E godot   :    at: load_default_certificates (modules/mbedtls/crypto_mbedtls.cpp:342)
02-09 13:32:16.519 23342 23394 E godot   : USER ERROR: Cannot get class 'CSharpScript'.
02-09 13:32:16.519 23342 23394 E godot   :    at: instantiate (core/object/class_db.cpp:359)
02-09 13:32:16.519 23342 23394 E godot   : USER ERROR: res://shade_scene.tscn:Resource of unrecognized type in file: CSharpScript.
02-09 13:32:16.519 23342 23394 E godot   :    at: load (core/io/resource_format_binary.cpp:762)
02-09 13:32:16.519 23342 23394 E godot   : USER ERROR: Failed loading resource: res://.godot/exported/133200997/export-6a459847f1b0e7a5df30194dc41776f7-shade_scene.scn. Make sure resources have been imported by opening the project in the editor at least once.
02-09 13:32:16.519 23342 23394 E godot   :    at: _load (core/io/resource_loader.cpp:276)

Steps to reproduce

  1. Download repo and switch to 4e990cd7e commit.
  2. Build editor scons p=linuxbsd target=editor module_mono_enabled=yes.
  3. Build scons platform=android target=template_debug arch=arm64 export template.
  4. Move android_debug.apk to $HOME/.local/share/godot/export_templates/4.3.dev.mono/ and add version.txt` too.
  5. Follow steps on Exporting for Android.
  6. Install using ADB adb install MyApp.apk

Minimal reproduction project (MRP)

shadeslider_MRP.zip

@AlekseyKapustyanenko
Copy link
Contributor

AlekseyKapustyanenko commented Feb 10, 2024

Same error when building android templates from 3.5.3-stable git tag and using it to export to android.
After launching such app get such error:

 02-10 22:57:45.654  6962  8542 E godot   : ERROR: Condition "default_certs != nullptr" is true.
02-10 22:57:45.654  6962  8542 E godot   :    at: load_default_certificates (modules\mbedtls\crypto_mbedtls.cpp:314) - Condition "default_certs != nullptr" is true.
02-10 22:57:45.665  6962  8542 E godot   : ERROR: No loader found for resource: res://World.cs.
02-10 22:57:45.666  6962  8542 E godot   :    at: _load (core\io\resource_loader.cpp:278) - Method failed. Returning: RES()
02-10 22:57:45.666  6962  8542 E godot   : ERROR: res://World.tscn:3 - Parse Error: [ext_resource] referenced nonexistent resource at: res://World.cs
02-10 22:57:45.666  6962  8542 E godot   :    at: poll (scene\resources\resource_format_text.cpp:412) - res://World.tscn:3 - Parse Error: [ext_resource] referenced nonexistent resource at: res://World.cs

@AlekseyKapustyanenko
Copy link
Contributor

I also went through this document and compiled mono glue, but when I execute this command
scons platform=android target=release_debug android_arch=armv7 module_mono_enabled=yes mono_prefix="C:\Program Files\Mono"
I get such error:

RuntimeError: Could not find mono library in: C:\Program Files\Mono\lib:
  File "D:\Repos\godot\SConstruct", line 719:
    SConscript("modules/SCsub")
  File "C:\Python38\scons\SCons\Script\SConscript.py", line 660:
    return method(*args, **kw)
  File "C:\Python38\scons\SCons\Script\SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Python38\scons\SCons\Script\SConscript.py", line 286:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "D:\Repos\godot\modules\SCsub", line 21:
    SConscript(name + "/SCsub")  # Built-in.
  File "C:\Python38\scons\SCons\Script\SConscript.py", line 660:
    return method(*args, **kw)
  File "C:\Python38\scons\SCons\Script\SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Python38\scons\SCons\Script\SConscript.py", line 286:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "D:\Repos\godot\modules\mono\SCsub", line 34:
    mono_configure.configure(env, env_mono)
  File "D:\Repos\godot\modules\mono\build_scripts\mono_configure.py", line 253:
    raise RuntimeError("Could not find mono library in: " + mono_lib_path)

@zaevi
Copy link
Contributor

zaevi commented Feb 13, 2024

Seems your scene accidentally embed C# script in it. You can try re-attach the correct C# script path (res://SlideShader.cs)

This couldn't happen, but I've seen it a several times recently.

image

@zmertens
Copy link
Author

Seems your scene accidentally embed C# script in it. You can try re-attach the correct C# script path (res://SlideShader.cs)

Ahh, removing the C# script fixes the issue, but I tried adding a new script to the ColorRect and it still embeds the C# in the .tscn file. Not sure why the path isn't reflected correctly in the .tscn file.

@raulsntos
Copy link
Member

C# doesn't support built-in scripts (scripts that are embedded in scene files), it shouldn't be possible to create embedded C# scripts but there's a bug that could be what you're experiencing:

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

Successfully merging a pull request may close this issue.

7 participants