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

apk tries to unpack assets into wrong directory #146

Closed
1000283 opened this issue Jan 10, 2023 · 3 comments
Closed

apk tries to unpack assets into wrong directory #146

1000283 opened this issue Jan 10, 2023 · 3 comments

Comments

@1000283
Copy link

1000283 commented Jan 10, 2023

Greetings and thanks for your work.

I've been migrating a legacy C app from SDL 1.2 to 2.0. The 1.2 version works fine when compiled on an Ubuntu Xenial but is quite dated (although i'll need to maintain it for a while or at least ensure i can maintain KitKat/Lollipop).

I'm using commit 798fd0f from 10/03/2022 on an Ubuntu Fossa and have been adapting scripts for the newer build but need to maintain access to /sdcard (that's out the window with Android 10 but that's another matter).

The build compiles fine and the assets.zip file is placed in the apk as intended, however when the apk is installed the system tries to unpack the assets onto /data/user/0/com.my.app.debug/files (to which adb shell ls has no permissions so i'm guessing neither does my app) when it used to unpack to /sdcard/Android/data/com.my.app.debug/files. So the app it fails to start because it's expecting assets that don't exist.

(Is does touch a file in /sdcard but is unable to replace it later with another file from assets because there is none.
It closes "gracefully" when trying to open a nonexisting font.ttf, without ever showing either of the un/successful log messages.
Works fine in Linux and Windows.)

I've "backported" most of the definitions to old values, but no matter what i put in android:installLocation it always defaults to the same location. The older build works fine on the same device.

Can you tell me what am i missing in order to get the old behavior?

This is the place in the log:

2023-01-10 15:09:01.713 32233-32233/com.my.app.debug I/SDL: libSDL: settings file not found: java.io.FileNotFoundException: /data/user/0/com.my.app.debug/files/libsdl-settings.cfg: open failed: ENOENT (No such file or directory)
2023-01-10 15:09:01.715 32233-32233/com.my.app.debug I/SDL: libSDL: setting envvar LANGUAGE
2023-01-10 15:09:01.765 32233-32233/com.my.app.debug D/SDL: libSDL: Is running on OUYA: false
2023-01-10 15:09:01.772 32233-32233/com.my.app.debug V/SDL: chdir() to: /data/user/0/com.my.app.debug/files
2023-01-10 15:09:01.773 32233-32233/com.my.app.debug I/SDL: Starting data download
2023-01-10 15:09:01.809 32233-32233/com.my.app.debug V/SDL: onStart()

This is my env:
ANDROID_NDK_HOME=/opt/android/ndk/22.0.7026061
ANDROID_HOME=/usr/lib/android-sdk
NDK=/opt/android/ndk/22.0.7026061
ANDROID_NDK_ROOT=/opt/android/ndk/22.0.7026061

And the files i'm using:
project/settings.gradle
project/jni/sdl2/android-project/app/src/main/AndroidManifest.xml
project/app/build-templace.gradle
project/build.gradle

The generated AndroidManifest.xml. It has android:installLocation="0", which doesn't seem to be recognized, instead of android:installLocation="auto" but so did the old one.

@pelya
Copy link
Owner

pelya commented Jan 10, 2023 via email

@1000283
Copy link
Author

1000283 commented Jan 10, 2023

Turns out the newest version expects AppDataDownloadUrl="!MyAssets|myassets.zip" instead of the previous AppDataDownloadUrl="|myassets.zip". Now the app loads the assets and starts as expected.
Well i get a black screen and the app seems dead, but that's another issue, possibly SDL2-related.

@pelya
Copy link
Owner

pelya commented Jan 10, 2023 via email

@1000283 1000283 closed this as completed Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants