kivy / kivy/python-for-android
Making a Kivy System app on Android
- Dominant language
- Python
- Stars
- 8.9k
- Forks
- 2k
- Avg merge
- 12h 20m
- Merged PRs (30d)
- 9
Description
Let me explain what I am trying to do. I have an Orange Pi 5 Plus on which I am running Android 12. I did build a Kivy application that is working well (Kivy can be used to make Applications using Python). But some very specific reasons, I would like to make this application a system app.
When I installed the application normally with no special privileges, it works well. When I recompile Android12 and integrate the app on the product partition, it does not work.
When I launch the application, I first get an error message displayed on the scree saying: `Could not extract /product/priv-app/myapp/lib/arm64/libpybundle data`.
Then when I look at logcat, I see FATAL exception related to `UnsatisfiedLinkError: No implementation found for void org.libsdl.app.SDLActivity.nativeSetenv`.
Here is the log I get.
```
10-19 23:06:46.136 610 3321 I ActivityTaskManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.test.myapp/org.kivy.android.PythonActivity bnds=[1276,609][1592,761]} from uid 10079
10-19 23:06:46.171 610 667 I ActivityManager: Start proc 3338:org.test.myapp/1000 for pre-top-activity {org.test.myapp/org.kivy.android.PythonActivity}
--------- beginning of main
10-19 23:06:46.248 3338 3338 V GraphicsEnvironment: ANGLE Developer option for 'org.test.myapp' set to: 'default'
10-19 23:06:46.248 3338 3338 V GraphicsEnvironment: ANGLE GameManagerService for org.test.myapp: false
--------- beginning of crash
10-19 23:06:46.369 3338 3338 E AndroidRuntime: FATAL EXCEPTION: SDLActivity
10-19 23:06:46.369 3338 3338 E AndroidRuntime: Process: org.test.myapp, PID: 3338
10-19 23:06:46.369 3338 3338 E AndroidRuntime: java.lang.UnsatisfiedLinkError: No implementation found for void org.libsdl.app.SDLActivity.nativeSetenv(java.lang.String, java.lang.String) (tried Java_org_libsdl_app_SDLActivity_nativeSetenv and Java_org_libsdl_app_SDLActivity_nativeSetenv__Ljava_lang_String_2Ljava_lang_String_2)
10-19 23:06:46.369 3338 3338 E AndroidRuntime: at org.libsdl.app.SDLActivity.nativeSetenv(Native Method)
10-19 23:06:46.369 3338 3338 E AndroidRuntime: at org.kivy.android.PythonActivity$UnpackFilesTask.onPostExecute(PythonActivity.java:158)
10-19 23:06:46.369 3338 3338 E AndroidRuntime: at org.kivy.android.PythonActivity$UnpackFilesTask.onPostExecute(PythonActivity.java:102)
10-19 23:06:46.369 3338 3338 E AndroidRuntime: at android.os.AsyncTask.finish(AsyncTask.java:771)
10-19 23:06:46.369 3338 3338 E AndroidRuntime: at android.os.AsyncTask.access$900(AsyncTask.java:199)
10-19 23:06:46.369 3338 3338 E AndroidRuntime: at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:788)
10-19 23:06:46.369 3338 3338 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
10-19 23:06:46.369 3338 3338 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:201)
10-19 23:06:46.369 3338 3338 E AndroidRuntime: at android.os.Looper.loop(Looper.java:288)
10-19 23:06:46.369 3338 3338 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7870)
10-19 23:06:46.369 3338 3338 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
10-19 23:06:46.369 3338 3338 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
10-19 23:06:46.369 3338 3338 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
10-19 23:06:46.370 610 2995 W ActivityTaskManager: Force finishing activity org.test.myapp/org.kivy.android.PythonActivity
10-19 23:06:46.393 610 1339 I ActivityManager: Process org.test.myapp (pid 3338) has died: fg TOP
10-19 23:06:46.393 610 1050 I WindowManager: WIN DEATH: Window{bf9e3f6 u0 org.test.myapp/org.kivy.android.PythonActivity}
10-19 23:06:46.393 610 1050 W InputManager-JNI: Input channel object 'bf9e3f6 org.test.myapp/org.kivy.android.PythonActivity (client)' was disposed without first being removed with the input manager!
10-19 23:06:46.394 610 702 I WindowManager: WIN DEATH: Window{138fccd u0 org.test.myapp/org.kivy.android.PythonActivity}
10-19 23:06:46.394 610 702 W InputManager-JNI: Input channel object '138fccd org.test.myapp/org.kivy.android.PythonActivity (client)' was disposed without first being removed with the input manager!
10-19 23:06:46.413 610 661 W InputManager-JNI: Input channel object 'af93b09 Splash Screen org.test.myapp (client)' was disposed without first being removed with the input manager!
10-19 23:06:46.871 610 660 W ActivityTaskManager: Activity top resumed state loss timeout for ActivityRecord{b390ac2 u0 org.test.myapp/org.kivy.android.PythonActivity t-1 f}}
```
Does anybody have a clue what is going wrong? Any help would be much appreciated. Thanks
I am expecting the application to run the same way as a user app.
Contributor guide
Research direction
Start with org.kivy.android.PythonActivity, especially UnpackFilesTask around line 158, and compare the product-partition packaging with the normal user-app build. Use the supplied logcat and the lib/arm64/libpybundle extraction failure as the first checks. Done means the Android 12 system-installed app launches and behaves like the working user-installed app without the nativeSetenv crash.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, python
- Domain
- mobile-dev, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100