godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.94k stars 20.17k forks source link

Exporting to Android AAB is missing assets (regression from #52526) #53328

Closed daansystems closed 2 years ago

daansystems commented 2 years ago

Godot version

3.x

System information

Windows 10

Issue description

It seems the custom android export to aab no longer includes the assets of the project, could this have anything to do with commit 35a98d305bf4133fdfc33c18d269226bff5aa416 "Add support for Play Asset Delivery." Exporting an apk works fine. Is is possible to disable this assetPacks feature?

Steps to reproduce

Install Android build template, Use custom build, Select Export AAB, close the export dialog. Run the project on an android device/emulator, it will crash on start.

Minimal reproduction project

No response

daansystems commented 2 years ago

bundlefail.zip

A small example project. I had to remove the android/build/libs/debug/godot-lib.debug.aar from zip, else the upload file is too large. It was compiled using the current head of 3.x

m4gr3d commented 2 years ago

@daansystems can you specify the commands you're using to run the project, and which version of Android you're running the project on. Can you also provide the crash stack trace.

jimbofoo commented 2 years ago

@m4gr3d , I'm just clicking the run on android device icon in godot's main window. here's the build config:

ext.versions = [
    androidGradlePlugin: '4.2.1',
    compileSdk         : 29,
    minSdk             : 18,
    targetSdk          : 29,
    buildTools         : '30.0.3',
    supportCoreUtils   : '1.0.0',
    kotlinVersion      : '1.5.10',
    v4Support          : '1.0.0',
    javaVersion        : 1.8,
    ndkVersion         : '21.4.7075529' // Also update 'platform/android/detect.py#get_project_ndk_version()' when this is updated.
]

The stacktrace of the crash:

10-02 17:31:16.734 12222 12222 W System.err: java.io.FileNotFoundException: _cl_
10-02 17:31:16.735 12222 12222 W System.err:    at android.content.res.AssetManager.nativeOpenAsset(Native Method)
10-02 17:31:16.735 12222 12222 W System.err:    at android.content.res.AssetManager.open(AssetManager.java:874)
10-02 17:31:16.735 12222 12222 W System.err:    at android.content.res.AssetManager.open(AssetManager.java:851)
10-02 17:31:16.735 12222 12222 W System.err:    at org.godotengine.godot.Godot.parseCommandLine(Godot.java:497)
10-02 17:31:16.736 12222 12222 W System.err:    at org.godotengine.godot.Godot.getCommandLine(Godot.java:480)
10-02 17:31:16.736 12222 12222 W System.err:    at org.godotengine.godot.Godot.onCreate(Godot.java:614)
10-02 17:31:16.736 12222 12222 W System.err:    at androidx.fragment.app.Fragment.performCreate(Fragment.java:2414)
10-02 17:31:16.736 12222 12222 W System.err:    at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManager.java:1418)
10-02 17:31:16.737 12222 12222 W System.err:    at androidx.fragment.app.FragmentTransition.addToFirstInLastOut(FragmentTransition.java:1195)
10-02 17:31:16.737 12222 12222 W System.err:    at androidx.fragment.app.FragmentTransition.calculateFragments(FragmentTransition.java:1078)
10-02 17:31:16.737 12222 12222 W System.err:    at androidx.fragment.app.FragmentTransition.startTransitions(FragmentTransition.java:117)
10-02 17:31:16.737 12222 12222 W System.err:    at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2408)
10-02 17:31:16.737 12222 12222 W System.err:    at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366)
10-02 17:31:16.737 12222 12222 W System.err:    at androidx.fragment.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:2243)
10-02 17:31:16.737 12222 12222 W System.err:    at androidx.fragment.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:654)
10-02 17:31:16.737 12222 12222 W System.err:    at org.godotengine.godot.FullScreenGodotApp.onCreate(FullScreenGodotApp.java:61)
10-02 17:31:16.737 12222 12222 W System.err:    at com.godot.game.GodotApp.onCreate(GodotApp.java:45)
10-02 17:31:16.737 12222 12222 W System.err:    at android.app.Activity.performCreate(Activity.java:8000)
10-02 17:31:16.737 12222 12222 W System.err:    at android.app.Activity.performCreate(Activity.java:7984)
10-02 17:31:16.738 12222 12222 W System.err:    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
10-02 17:31:16.738 12222 12222 W System.err:    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
10-02 17:31:16.738 12222 12222 W System.err:    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
10-02 17:31:16.738 12222 12222 W System.err:    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
10-02 17:31:16.739 12222 12222 W System.err:    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
10-02 17:31:16.739 12222 12222 W System.err:    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
10-02 17:31:16.739 12222 12222 W System.err:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
10-02 17:31:16.739 12222 12222 W System.err:    at android.os.Handler.dispatchMessage(Handler.java:106)
10-02 17:31:16.739 12222 12222 W System.err:    at android.os.Looper.loop(Looper.java:223)
10-02 17:31:16.739 12222 12222 W System.err:    at android.app.ActivityThread.main(ActivityThread.java:7656)
10-02 17:31:16.739 12222 12222 W System.err:    at java.lang.reflect.Method.invoke(Native Method)
10-02 17:31:16.739 12222 12222 W System.err:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
10-02 17:31:16.739 12222 12222 W System.err:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

10-02 17:31:17.069 12222 12275 E godot   : ERROR: Couldn't load file 'res://project.binary', error code 19.
10-02 17:31:17.071 12222 12275 E godot   :    at: _load_settings_text_or_binary (core\project_settings.cpp:600) - Couldn't load file 'res://project.binary', error code 19.

This is probably caused by the missing of the assets directory in the apk/bundle.

akien-mga commented 2 years ago

It could also be a version mismatch. Did you generate and install the custom build template from the exact same commit that you use for the editor? Alternatively, do you have this issue with official 3.4 beta 5 builds (also making sure to reinstall the source template with that version)?

Edit: error 19 is ERR_FILE_MISSING_DEPENDENCIES so that does seem to confirm some missing or incompatible files.

m4gr3d commented 2 years ago

@jimbofoo This looks like a version mismatch. Your compileSdk version is 29 while the version with play asset delivery support should be 30. Make sure you delete you're android directory in the project and recreate it using the Install Android Build Template... option.

Also for additional info, clicking the android icon in the editor always uses the apk export format regardless of the export format set in the editor export window, so it's not subject to the play asset delivery logic.

daansystems commented 2 years ago

I can reproduce the issue with the build from: https://downloads.tuxfamily.org/godotengine/3.4/beta5/ I've reinstalled the android build template from the export templates.

I have uploaded the full project with the android custom build here: https://www.daansystems.com/tmp/godot_issue_53328.zip

I've also created a little movie displaying the issue

https://user-images.githubusercontent.com/4447520/135727577-9e75a1a6-830e-4707-bc22-f1d56bf751db.mp4

akien-mga commented 2 years ago

I can reproduce the issue with 3.4 beta 6 and the test project in https://github.com/godotengine/godot/issues/53328#issuecomment-932713732.

The AAB doesn't seem to include any assets aside from the icons indeed.

Edit: I do see the assets actually under installTime: Screenshot_20211011_162759

But apparently they're not found/put in the expect place when installing the AAB?

akien-mga commented 2 years ago

I confirmed that it's a regression from #52526, a local revert of that PR seems to solve the issue.

m4gr3d commented 2 years ago

@daansystems Thanks for the video, it gives me an idea of what the issue is.

jimbofoo commented 2 years ago

I think the issue is not in the AAB (it includes the assets with the new Play Asset delivery structure). But in the generated APK when clicking run while AAB export format is selected. So the title of this issue needs to be something like "APK misses assets when export format is set to AAB". Sorry for the confusion.

m4gr3d commented 2 years ago

@jimbofoo That's correct! I found the issue though and will be pushing a fix shortly!