taichi-dev / taichi-aot-demo

A demo illustrating how to use Taichi as an AOT shader compiler
Apache License 2.0
71 stars 16 forks source link

The demo app crashes when opening on the mobile phone #124

Closed dspcad closed 1 year ago

dspcad commented 1 year ago

Just follow the instructions and generate the apk files. I use the debug apk to install it on the phone. However, the installed app flashes and then, crashes. Is there anything I missed? Thanks.

PENGUINLIONG commented 1 year ago

Could you provide more detail about your test platform? Like Android version (API level), vendor, chip version, etc. The things are continuously tested by our CI server so it's quite unlikely the Android build would break.

dspcad commented 1 year ago

Actually, I just run three scripts described in https://github.com/taichi-dev/taichi-aot-demo/tree/master/framework

I couldn't use Android Studio to build because of the error "Cause: globalScope.projectBaseName must not be null" My related environment variables are shown below: TAICHI_C_API_INSTALL_DIR=/path/to/taichi-aot-demo/build-taichi-android-aarch64/install/c_api/ TAICHI_REPO_DIR=/path/to/taichi/ ANDROID_NDK_ROOT=/path/to/Android/Sdk/ndk/25.2.9519653

My OS is ubuntu 22.04

Thanks.

PENGUINLIONG commented 1 year ago

Well I mean the device you run your app. Your compilation setup seems correct

dspcad commented 1 year ago

oppo_phone Build number: PCCM00_11_A.01_9bbaf491 Baseband version: Q_V1_P14 Kernel version: 4.9.112

Is the information above good for you?

PENGUINLIONG commented 1 year ago

That's funny because that's my test device (SDM855 is Snapdragon 855) and that's a quite robust platform. But honestly Android 9 is pretty old. Google added Vulkan support in Android 7 and things doesn't break so often only after a couple of years. So I think it's more likely a driver issue.

dspcad commented 1 year ago

If you would like to guide me on how to update the driver, that would be great :) Would you like to provide the information about your test phone? Many thanks for your quick reply.

PENGUINLIONG commented 1 year ago

Mine is an old Xperia 1. It has the same chip Snapdragon 855 but in Android 10 (or 11? I forgot). Android GPU driver is updated together with system updates (usually) so you might wanna check that. But sorry I can't give you more hint than that. Everything works well in my case lol.

dspcad commented 1 year ago

It is OK. Would you mind sharing the screenshot of running the app on your old Xperia 1 lol I will give it a try on Android 10/11 and share my results if I succeed.

PENGUINLIONG commented 1 year ago

It should be the same as this https://github.com/taichi-dev/taichi-aot-demo/blob/master/ci/headless-truths/linux/vulkan/E5_sph_headless.bmp. It's not currently with me.

dspcad commented 1 year ago

The headless and glfw work for me so android one should look the same as them, right?

PENGUINLIONG commented 1 year ago

Yes. All demos in this repo use the same code to run Taichi kernels. The only difference is headless writes to images and GLFW & Android app presents to a GUI window.

dspcad commented 1 year ago

Hi I tried a new phone but still failed. Below is the info of my test phone. I installed debug apk like E5_sph-debug.apk. Is it correct? I couldn't install the release version because of the error db: failed to install E5_sph-release-unsigned.apk: Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES: Failed collecting certificates for /data/app/vmdl1448463087.tmp/base.apk: Failed to collect certificates from /data/app/vmdl1448463087.tmp/base.apk: Attempt to get length of null array]

oppo_phone2

I am clearing any warnings. Do you see these warnings before? image

dspcad commented 1 year ago

I fixed the problem. I need to copy libtaichi_c_api.so to jniLibs. Below is the result and thanks for your help :) aot_oppo_demo

PENGUINLIONG commented 1 year ago

Cool! I'm closing this issue then. :)