Android (custom build) unable to load resources from folders with _ prefix

Godot version

3.3.2.stable.official

System information

macOS Catalina (10.15.7)

Issue description

When making custom builds for android and you have a resource folder prefixed with _ the project fails to load files from said folder.

When running the project the following error is emitted (multiple times because of retry poll):

E/godot: **ERROR**: No loader found for resource: res://_shared/circle.png.
       At: core/io/resource_loader.cpp:290:_load() - Method failed. Returning: RES()
    **ERROR**: res://test.tscn:3 - Parse Error: [ext_resource] referenced nonexistent resource at: res://_shared/circle.png
       At: scene/resources/resource_format_text.cpp:440:poll() - res://test.tscn:3 - Parse Error: [ext_resource] referenced nonexistent resource at: res://_shared/circle.png
    **ERROR**: Failed to load resource 'res://test.tscn'.
       At: core/io/resource_loader.cpp:212:load() - Condition "err != OK" is true. Returned: RES()
    **ERROR**: Failed loading resource: res://test.tscn. Make sure resources have been imported by opening the project in the editor at least once.
       At: core/io/resource_loader.cpp:283:_load() - Condition "found" is true. Returned: RES()
    **ERROR**: res://main.tscn:4 - Parse Error: [ext_resource] referenced nonexistent resource at: res://test.tscn
       At: scene/resources/resource_format_text.cpp:440:poll() - res://main.tscn:4 - Parse Error: [ext_resource] referenced nonexistent resource at: res://test.tscn
    **ERROR**: Failed to load resource 'res://main.tscn'.
       At: core/io/resource_loader.cpp:212:load() - Condition "err != OK" is true. Returned: RES()
    **ERROR**: Failed loading resource: res://main.tscn. Make sure resources have been imported by opening the project in the editor at least once.
       At: core/io/resource_loader.cpp:283:_load() - Condition "found" is true. Returned: RES()
    **ERROR**: Failed loading scene: res://main.tscn
       At: main/main.cpp:1961:start() - Condition "!scene" is true. Returned: false

This only seems to be the case if the resource is loaded through a PackedScene linked to the main scene.

Steps to reproduce

using sample project

  1. open the attached test project
  2. Project > Install android build template …
  3. Export .apk and install on device
  4. Open logcat
  5. Open installed .apk and see it crash with above error

(Or open /android/build in AndroidStudio and debug from there, make sure all assets are copied to android project before running.)

full

  1. create godot project
  2. add a folder named _shared
  3. add something.png asset to _shared
  4. create a main scene
    • add a script with export(PackedScene) var next
  5. create another scene
    • add a sprite using _shared/something.png as texture
  6. go back to main scene
    • link another scene to next property
  7. Project > Install android build template …
  8. Project > Export…
    • Add… > Android
    • Use custom builds = true
    • add debug keystore if not already done in editor config
    • export project apk and follow the above to see the error

Minimal reproduction project

GodotUnderscoreAndroid.zip

export.apk.zip

1 thought on “Android (custom build) unable to load resources from folders with _ prefix

Comments are closed.