utopia-rise / godot-kotlin-jvm

Godot Kotlin JVM Module
MIT License
586 stars 39 forks source link

No loader found for resource: res://[...].kt #302

Closed elfefe closed 1 year ago

elfefe commented 2 years ago

Hey, The application build and start correctly on Android, but then i have a black screen and this error who indicate an issue when reading the kotlin files at runtime:

E/godot: ERROR: No loader found for resource: res://src/main/kotlin/com/gameoftricks/jmcity/JMAnimator.kt. E/godot: at: _load (core/io/resource_loader.cpp:278) - Method failed. Returning: RES()

I use d8 for the build:

godot {
    isAndroidExportEnabled.set(true)
    d8ToolPath.set(File("${System.getenv("ANDROID_SDK_ROOT")}/build-tools/32.0.0/d8"))
    androidCompileSdkDir.set(File("${System.getenv("ANDROID_SDK_ROOT")}/platforms/android-32"))
}

The full log error:

2022-01-31 16:11:51.933 4928-4994/org.godotengine.jmcity E/godot: ERROR: No loader found for resource: res://src/main/kotlin/com/gameoftricks/jmcity/JMAnimator.kt. 2022-01-31 16:11:51.946 4928-4994/org.godotengine.jmcity E/godot: at: _load (core/io/resource_loader.cpp:278) - Method failed. Returning: RES() 2022-01-31 16:11:51.952 4928-4994/org.godotengine.jmcity E/godot: ERROR: res://src/main/resources/scenes/Main.tscn:263 - Parse Error: [ext_resource] referenced nonexistent resource at: res://src/main/kotlin/com/gameoftricks/jmcity/JMAnimator.kt 2022-01-31 16:11:51.952 4928-4994/org.godotengine.jmcity E/godot: at: poll (scene/resources/resource_format_text.cpp:412) - res://src/main/resources/scenes/Main.tscn:263 - Parse Error: [ext_resource] referenced nonexistent resource at: res://src/main/kotlin/com/gameoftricks/jmcity/JMAnimator.kt 2022-01-31 16:11:51.956 4928-4994/org.godotengine.jmcity E/godot: ERROR: Failed to load resource 'res://src/main/resources/scenes/Main.tscn'. 2022-01-31 16:11:51.956 4928-4994/org.godotengine.jmcity E/godot: at: load (core/io/resource_loader.cpp:206) - Condition "err != OK" is true. Returned: RES() 2022-01-31 16:11:51.983 4928-4994/org.godotengine.jmcity E/godot: ERROR: Failed loading resource: res://src/main/resources/scenes/Main.tscn. Make sure resources have been imported by opening the project in the editor at least once. 2022-01-31 16:11:51.983 4928-4994/org.godotengine.jmcity E/godot: at: _load (core/io/resource_loader.cpp:271) - Condition "found" is true. Returned: RES() 2022-01-31 16:11:51.986 4928-4994/org.godotengine.jmcity E/godot: ERROR: Failed loading scene: res://src/main/resources/scenes/Main.tscn 2022-01-31 16:11:51.986 4928-4994/org.godotengine.jmcity E/godot: at: start (main/main.cpp:2011) - Condition "!scene" is true. Returned: false 2022-01-31 16:11:52.028 4928-4980/org.godotengine.jmcity D/EGL_emulation: app_time_stats: avg=19183.46ms min=37.37ms max=38329.56ms count=2 2022-01-31 16:11:52.477 4928-4994/org.godotengine.jmcity E/godot: ERROR: Condition "default_certs != nullptr" is true. 2022-01-31 16:11:52.477 4928-4994/org.godotengine.jmcity E/godot: at: load_default_certificates (modules/mbedtls/crypto_mbedtls.cpp:314) - Condition "default_certs != nullptr" is true.

piiertho commented 2 years ago

Hello ! Did you installed godot kotlin android export template ? I think you're using official godot one.

elfefe commented 2 years ago

Hello ! Did you installed godot kotlin android export template ? I think you're using official godot one.

Do I just need to install the template ? Is there a documentation on how to use the template ? I've just tried with the template installed, it does the same ! I now have android (build, plugin, .build_version) on my resource tree, I've then reinstalled the application by clicking the android icon on the Godot editor and exactly the same problem happened.

piiertho commented 2 years ago

We miss the doc for this I think, we only say where you can find export template.
Download android templates here: https://github.com/utopia-rise/godot-kotlin-jvm/releases
Then, you have to install them to your godot userdir, following this documentation section: https://docs.godotengine.org/en/stable/development/compiling/compiling_for_android.html#using-the-export-templates

elfefe commented 2 years ago

We miss the doc for this I think, we only say where you can find export template. Download android templates here: https://github.com/utopia-rise/godot-kotlin-jvm/releases Then, you have to install them to your godot userdir, following this documentation section: https://docs.godotengine.org/en/stable/development/compiling/compiling_for_android.html#using-the-export-templates

Thanks you, I'm using godot.x11.opt.tools.64 as engine to start godot on linux. I see in the release comments that only the zip files are built engines anything else Is an export template, what do you mean ? (asking cuz i'm using the godot.x11.opt.tools.64 ̃o.O)

elfefe commented 2 years ago

Hey ! Here we go again :) I've successfully built the apk, but still the same issue ... Here is my configuration

So when the application is started, I've got a black screen and the logs loop on:

2022-01-31 16:50:02.574 7056-7101/org.godotengine.jmcity E/godot: ERROR: Condition "default_certs != nullptr" is true. 2022-01-31 16:50:02.574 7056-7101/org.godotengine.jmcity E/godot: at: load_default_certificates (modules/mbedtls/crypto_mbedtls.cpp:314) - Condition "default_certs != nullptr" is true. 2022-01-31 16:50:16.386 7056-7101/org.godotengine.jmcity E/godot: ERROR: No loader found for resource: res://src/main/kotlin/com/gameoftricks/jmcity/JMAnimator.kt. 2022-01-31 16:50:16.387 7056-7101/org.godotengine.jmcity E/godot: at: _load (core/io/resource_loader.cpp:278) - Method failed. Returning: RES() 2022-01-31 16:50:16.387 7056-7101/org.godotengine.jmcity E/godot: ERROR: res://src/main/resources/scenes/Main.tscn:263 - Parse Error: [ext_resource] referenced nonexistent resource at: res://src/main/kotlin/com/gameoftricks/jmcity/JMAnimator.kt 2022-01-31 16:50:16.387 7056-7101/org.godotengine.jmcity E/godot: at: poll (scene/resources/resource_format_text.cpp:412) - res://src/main/resources/scenes/Main.tscn:263 - Parse Error: [ext_resource] referenced nonexistent resource at: res://src/main/kotlin/com/gameoftricks/jmcity/JMAnimator.kt 2022-01-31 16:50:16.387 7056-7101/org.godotengine.jmcity E/godot: ERROR: Failed to load resource 'res://src/main/resources/scenes/Main.tscn'. 2022-01-31 16:50:16.387 7056-7101/org.godotengine.jmcity E/godot: at: load (core/io/resource_loader.cpp:206) - Condition "err != OK" is true. Returned: RES() 2022-01-31 16:50:16.397 7056-7101/org.godotengine.jmcity E/godot: ERROR: Failed loading resource: res://src/main/resources/scenes/Main.tscn. Make sure resources have been imported by opening the project in the editor at least once. 2022-01-31 16:50:16.397 7056-7101/org.godotengine.jmcity E/godot: at: _load (core/io/resource_loader.cpp:271) - Condition "found" is true. Returned: RES() 2022-01-31 16:50:16.397 7056-7101/org.godotengine.jmcity E/godot: ERROR: Failed loading scene: res://src/main/resources/scenes/Main.tscn 2022-01-31 16:50:16.397 7056-7101/org.godotengine.jmcity E/godot: at: start (main/main.cpp:2011) - Condition "!scene" is true. Returned: false 2022-01-31 16:50:16.400 7056-7101/org.godotengine.jmcity D/EGL_emulation: app_time_stats: avg=13970.90ms min=13970.90ms max=13970.90ms count=1 2022-01-31 16:50:16.524 7056-7101/org.godotengine.jmcity E/godot: ERROR: Condition "default_certs != nullptr" is true. 2022-01-31 16:50:16.524 7056-7101/org.godotengine.jmcity E/godot: at: load_default_certificates (modules/mbedtls/crypto_mbedtls.cpp:314) - Condition "default_certs != nullptr" is true.

piiertho commented 2 years ago

Sorry for late reply, too busy those days.
Can you try to place our export template in your userdir instead of in configuration ?
https://docs.godotengine.org/en/stable/development/compiling/compiling_for_android.html#installing-the-templates

chippmann commented 2 years ago

We miss the doc for this I think, we only say where you can find export template. Download android templates here: https://github.com/utopia-rise/godot-kotlin-jvm/releases Then, you have to install them to your godot userdir, following this documentation section: https://docs.godotengine.org/en/stable/development/compiling/compiling_for_android.html#using-the-export-templates

Thanks you, I'm using godot.x11.opt.tools.64 as engine to start godot on linux. I see in the release comments that only the zip files are built engines anything else Is an export template, what do you mean ? (asking cuz i'm using the godot.x11.opt.tools.64 ̃o.O)

Hmm this sounds to me that you are using the official godot build? This phrase basically means that per platform we have a prebuilt editor which contains our module. So to be able to run any kotlin code with godot you have to use our custom built godot editor. Not sure if you are already using that?

chippmann commented 2 years ago

@elfefe Do you still have this issue or was it related to the engine build you were using?

elfefe commented 2 years ago

@chippmann The problem as persisted, and I could not find any solution for it.

I setup the kotlin version of godot and the Android build environment wich worked as it was compiling and installing on my mobile.

The application start but then the black screen issue persist..

chippmann commented 1 year ago

@elfefe I think you issue might be fixed by https://github.com/utopia-rise/godot-kotlin-jvm/pull/348 (since version 0.5.0-3.5.0). If not; please provide a little repro as I cannot reproduce this issue.