kivy / python-for-android

Turn your Python application into an Android APK
https://python-for-android.readthedocs.io
MIT License
8.08k stars 1.8k forks source link

Older android version can't load libraries properly #925

Closed nesergen closed 5 years ago

nesergen commented 7 years ago

I have compile the KivyLauncher to APK with p4a : clean_dists&& p4a clean_builds&& p4a apk --requirements=sqlite3,hostpython2,plyer,kivy --package=org.test.launcher --name="Launcher" --version=0.0.1 --android_api 17 --bootstrap=pygame --launcher --permission WRITE_EXTERNAL_STORAGE --permission READ_EXTERNAL_STORAGE --permission ACCESS_CHECKIN_PROPERTIES --permission CAMERA --permission EXPAND_STATUS_BAR

All compiled perfect. But when I run programm in Launcher the Error occures. I do not know what to do . Please, tell me where may be the bug ?

ERROR: 11-13 00:50:16.050: I/ActivityManager(465): START u0 {act=org.renpy.LAUNCH dat=kivy:/storage/emulated/0/kivy/trade_sql cmp=org.test.launcher/org.renpy.android.PythonActivity} from pid 6181 11-13 00:50:16.169: I/ActivityManager(465): Start proc org.test.launcher:python for activity org.test.launcher/org.renpy.android.PythonActivity: pid=6208 uid=10114 gids={50114, 1015, 1028, 1006} 11-13 00:50:16.255: V/ActivityManager(465): Binding process pid 6208 to record ProcessRecord{42b3e7b8 6208:org.test.launcher:python/u0a10114} 11-13 00:50:16.257: V/ActivityManager(465): New app record ProcessRecord{42b3e7b8 6208:org.test.launcher:python/u0a10114} thread=android.os.BinderProxy@42738e90 pid=6208 11-13 00:50:16.417: V/ActivityManager(465): ACT-Launching: ActivityRecord{427c27c8 u0 org.test.launcher/org.renpy.android.PythonActivity} 11-13 00:50:16.773: D/dalvikvm(6208): Trying to load lib /data/app-lib/org.test.launcher-1/libpython2.7.so 0x421912c8 11-13 00:50:16.774: E/dalvikvm(6208): dlopen("/data/app-lib/org.test.launcher-1/libpython2.7.so") failed: Cannot load library: soinfo_link_image(linker.cpp:1635): could not load library "libsqlite3.so" needed by "libpython2.7.so"; caused by load_library(linker.cpp:745): library "libsqlite3.so" not found 11-13 00:50:16.786: V/WindowManager(465): Changing focus from null to Window{42c3c708 u0 org.test.launcher/org.renpy.android.PythonActivity} 11-13 00:50:16.791: E/AndroidRuntime(6208): java.lang.UnsatisfiedLinkError: Cannot load library: soinfo_link_image(linker.cpp:1635): could not load library "libsqlite3.so" needed by "libpython2.7.so"; caused by load_library(linker.cpp:745): library "libsqlite3.so" not found 11-13 00:50:16.791: E/AndroidRuntime(6208): at org.renpy.android.PythonActivity.run(PythonActivity.java:254) 11-13 00:50:17.069: I/WindowManager(465): Gaining focus: Window{42c3c708 u0 org.test.launcher/org.renpy.android.PythonActivity} 11-13 00:50:17.207: W/ActivityManager(465): Force finishing activity org.test.launcher/org.renpy.android.PythonActivity 11-13 00:50:17.210: V/WindowManager(465): Changing focus from Window{42c3c708 u0 org.test.launcher/org.renpy.android.PythonActivity} to null 11-13 00:50:17.218: I/WindowManager(465): Losing focus: Window{42c3c708 u0 org.test.launcher/org.renpy.android.PythonActivity} 11-13 00:50:17.549: V/ActivityManager(465): Enqueueing pending finish: ActivityRecord{427c27c8 u0 org.test.launcher/org.renpy.android.PythonActivity} 11-13 00:50:17.623: D/AES(465): process : org.test.launcher:python 11-13 00:50:17.628: D/AEE/LIBAEE(465): shell: raise_exp(2, 6208, -1361051648, org.test.launcher:python, 0x0x59762008, 0x0x0) 11-13 00:50:18.211: W/InputDispatcher(465): channel '42c3c708 org.test.launcher/org.renpy.android.PythonActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9 11-13 00:50:18.211: E/InputDispatcher(465): channel '42c3c708 org.test.launcher/org.renpy.android.PythonActivity (server)' ~ Channel is unrecoverably broken and will be disposed! 11-13 00:50:18.211: I/ActivityManager(465): Process org.test.launcher:python (pid 6208) has died. 11-13 00:50:18.217: I/WindowState(465): WIN DEATH: Window{42c3c708 u0 org.test.launcher/org.renpy.android.PythonActivity} 11-13 00:50:18.217: W/InputDispatcher(465): Attempted to unregister already unregistered input channel '42c3c708 org.test.launcher/org.renpy.android.PythonActivity (server)' 11-13 00:50:18.217: W/WindowManager(465): Force-removing child win Window{42c981e8 u0 SurfaceView} from container Window{42c3c708 u0 org.test.launcher/org.renpy.android.PythonActivity}

KeyWeeUsr commented 7 years ago

Seems to be some kind of issue with loading sqlite3, but personally I haven't compiled with higher api than 14 (8 to 14) so I don't know if that could cause the crash too. Anyway, if you don't really need sqlite3, try to remove it and check if the launcher works after it (you'll need to clean dist as sqlite3 will be still there).

Anyway, last time I've compiled pygame launcher (in May), it worked with this:

p4a clean_builds && p4a clean_dists &&
p4a apk --requirements=docutils,python2,sqlite3,openssl,pyopenssl,audiostream,cymunk,pil,pyjnius,twisted,plyer,pygments,kivy
--package=<package> --name="Launcher" --version=1.0 --bootstrap=pygame
--launcher --minsdk 13 --android_api 14

Also, I'm not familiar with using hostpython2 directly as a requirement so this could be the thing too.

I'd like to recommend you the sdl2 version of launcher (pygame is almost deprecated) which should be in quite usable state not only for casual apps → https://github.com/kivy/python-for-android/pull/891 but to use that you'll need to use the instructions provided there until it's merged.

git clone -b sdl2_launcher https://github.com/KeyWeeUsr/python-for-android
cd python-for-android

apply https://github.com/kivy/python-for-android/pull/896 changes to that file

(sudo) pip install .
python testapps/testlauncher_setup/sdl2.py apk

Put apps into /sdcard/kivy/ as it's stated in the docs.

nesergen commented 7 years ago

I have compiled sdl2-launcher , but same Error appeared.

1-13 22:08:44.205  29325-29325/org.kivy.testlauncher_sdl2 V/python: extracting lib/python2.7/config/install-sh
11-13 22:08:44.206  29325-29325/org.kivy.testlauncher_sdl2 V/python: extracting lib/python2.7/config/config.c.in
11-13 22:08:44.207  29325-29325/org.kivy.testlauncher_sdl2 V/python: extracting lib/python2.7/config/Makefile
11-13 22:08:44.210  29325-29325/org.kivy.testlauncher_sdl2 V/python: extracting lib/python2.7/config/Setup.local
11-13 22:08:44.262  29325-29325/org.kivy.testlauncher_sdl2 V/PythonActivity: About to do super onCreate
11-13 22:08:44.304  29325-29325/org.kivy.testlauncher_sdl2 D/dalvikvm: Trying to load lib /data/app-lib/org.kivy.testlauncher_sdl2-1/libpython2.7.so 0x42191c08
11-13 22:08:44.310  29325-29325/org.kivy.testlauncher_sdl2 E/dalvikvm: dlopen("/data/app-lib/org.kivy.testlauncher_sdl2-1/libpython2.7.so") failed: Cannot load library: soinfo_link_image(linker.cpp:1635): could not load library "libsqlite3.so" needed by "libpython2.7.so"; caused by load_library(linker.cpp:745): library "libsqlite3.so" not found
11-13 22:08:44.316  29325-29325/org.kivy.testlauncher_sdl2 W/System.err: Couldn't load python3.5m from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.kivy.testlauncher_sdl2-1.apk"],nativeLibraryDirectories=[/data/app-lib/org.kivy.testlauncher_sdl2-1, /vendor/lib, /system/lib]]]: findLibrary returned null
11-13 22:08:45.001      465-949/? V/WindowManager: Changing focus from null to Window{43606f48 u0 org.kivy.testlauncher_sdl2/org.kivy.android.PythonActivity}
11-13 22:08:45.004      465-482/? I/WindowManager: Gaining focus: Window{43606f48 u0 org.kivy.testlauncher_sdl2/org.kivy.android.PythonActivity}
11-13 22:08:45.005  29325-29325/org.kivy.testlauncher_sdl2 V/PythonActivity: Did super onCreate
11-13 22:08:45.012  29325-29325/org.kivy.testlauncher_sdl2 V/PythonActivity: Setting env vars for start.c and Python to use
11-13 22:08:45.012  29325-29325/org.kivy.testlauncher_sdl2 V/PythonActivity: Access to our meta-data...
11-13 22:08:45.013  29325-29325/org.kivy.testlauncher_sdl2 I/PythonActivity: Surface will NOT be transparent
11-13 22:08:45.611      465-482/? I/ActivityManager: [AppLaunch] Displayed Displayed org.kivy.testlauncher_sdl2/org.kivy.android.PythonActivity: +1m2s515ms
11-13 22:08:45.611      465-482/? D/ActivityManager: AP_PROF:AppLaunch_LaunchTime:org.kivy.testlauncher_sdl2/org.kivy.android.PythonActivity:62515:55484262
11-13 22:08:45.613     465-1041/? V/ActivityManager: Activity idle: Token{42b172a0 ActivityRecord{42788758 u0 org.kivy.testlauncher_sdl2/org.kivy.android.PythonActivity}}
11-13 22:08:45.894      465-482/? D/ActivityManager: ACT-IDLE_NOW_MSG from windowsVisible() for idle: ActivityRecord{42788758 u0 org.kivy.testlauncher_sdl2/org.kivy.android.PythonActivity}

The bug implemented due compiling or it contained in parent parts of which there is a compilation , because the same error occurs in any other apk that I build with requirement=sqlite3. Even more incomprehensible is that library 'libsqlite3.so' contained in the compiled apk. Why it can't be imported on android??????????? I'm frustrate, desperate .............. 6 months of fighting with kivy, buildozer and p4a , but only errors appear. One error solved - new error appear.......

KeyWeeUsr commented 7 years ago

Ok, let's work with sdl2 launcher as people here kind of work rather directly with app packaging than launcher (and I really push this PR to be merged 😋 ), so if something is broken related to launcher, I'll probably need to fix it.

I tried sqlite3 with the test app, worked, so I presume the error is somewhere hidden. I opened the blacklist.txt in the dist (.local/something/.../pythonforandroid/dists/<dist>/blacklist.txt) and removed the last lines about sqlite3. Try this. If still some error pops out and is different from that above, post it here. If the same error pops out, rip p4a from the machine and do a clean install i.e.:

p4a clean_all
(sudo) pip uninstall python-for-android

Check if there's still something in .local/.../pythonforandroid/ if yes, remove it (builds, dists, everything).

git clone -b sdl2_launcher <me>
# patch the bdistapk file
# edit python-for-android/pythonforandroid/bootstraps/sdl2/build/blacklist.txt as mentioned above
# install

and create launcher from the test file with sqlite3 in requirements (don't forget commas + no comma at the end of requirements string).

nesergen commented 7 years ago

After make all changes described before the Same Error appear again. But I used this script for compile python testapps/testlauncher_setup/sdl2.py apk

Logcat:

11-16 23:15:28.793: I/ActivityManager(465): START u0 {act=org.kivy.LAUNCH dat=kivy:/storage/emulated/0/kivy/trade_sql cmp=org.kivy.testlauncher_sdl2/org.kivy.android.PythonActivity} from pid 14223
11-16 23:15:28.849: V/ActivityManager(465): ACT-Launching: ActivityRecord{426157d0 u0 org.kivy.testlauncher_sdl2/org.kivy.android.PythonActivity}
11-16 23:15:28.954: D/dalvikvm(14223): Trying to load lib /data/app-lib/org.kivy.testlauncher_sdl2-2/libpython2.7.so 0x4218b368
11-16 23:15:28.954: E/dalvikvm(14223): dlopen("/data/app-lib/org.kivy.testlauncher_sdl2-2/libpython2.7.so") failed: Cannot load library: soinfo_link_image(linker.cpp:1635): could not load library "libsqlite3.so" needed by "libpython2.7.so"; caused by load_library(linker.cpp:745): library "libsqlite3.so" not found
11-16 23:15:28.961: W/System.err(14223): Couldn't load python3.5m from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/org.kivy.testlauncher_sdl2-2.apk"],nativeLibraryDirectories=[/data/app-lib/org.kivy.testlauncher_sdl2-2, /vendor/lib, /system/lib]]]: findLibrary returned null
11-16 23:15:29.185: V/WindowManager(465): Changing focus from null to Window{42d17708 u0 org.kivy.testlauncher_sdl2/org.kivy.android.PythonActivity}
11-16 23:15:29.189: I/WindowManager(465): Gaining focus: Window{42d17708 u0 org.kivy.testlauncher_sdl2/org.kivy.android.PythonActivity}
11-16 23:15:29.211: V/PythonActivity(14223): Setting env vars for start.c and Python to use
11-16 23:15:29.638: I/ActivityManager(465): [AppLaunch] Displayed Displayed org.kivy.testlauncher_sdl2/org.kivy.android.PythonActivity: +790ms
11-16 23:15:29.639: D/ActivityManager(465): AP_PROF:AppLaunch_LaunchTime:org.kivy.testlauncher_sdl2/org.kivy.android.PythonActivity:790:136474377
11-16 23:15:29.691: V/ActivityManager(465): Activity idle: Token{42929990 ActivityRecord{426157d0 u0 org.kivy.testlauncher_sdl2/org.kivy.android.PythonActivity}}
11-16 23:15:29.950: D/ActivityManager(465): ACT-IDLE_NOW_MSG from windowsVisible() for idle: ActivityRecord{426157d0 u0 org.kivy.testlauncher_sdl2/org.kivy.android.PythonActivity}

I found the "libsqlite3.so" in the apk "/lib/armeabi/libsqlite3.so ". Why it can`t be loaded? What means this error "Couldn't load python3.5m from loader " ?

I have four applets for the KivyLauncher. All of them not work with my Launcher. But all of them work with Launcher from PlayMarket.

KeyWeeUsr commented 7 years ago

I seriously have no Idea what's wrong with sqlite3 for you. Otherwise, it works. Also, ignore the python3.5 error, it behaves like that because of this (the for loop) and therefore it tries to load everything from the loop and prints what it couldn't. To be more clear, when it's a python what should be loaded, it tries to load the py2 first (I think) and then it'll just enable a switch with skippedPython = true; to ignore python3.5.

Why you see the py3.5 error is basically because py2 wasn't loaded. And it wasn't loaded because something's wrong with your sqlite3. Does it have the right permissions in the app-lib folder? I have there -rwxr-xr-x, that's probably 644 or something. Other than that I'm lost what's wrong with it.

Just an idea, but if it works with the store Launcher, try to copy&paste the libsqlite3.so from that into your new Launcher, it might be a workaround, but a bad one though...

Any thoughts what might be wrong, @inclement ?

nesergen commented 7 years ago

I have got a clue ! I downloaded the kivy example applet 'KivyPictures' from PlayMarket. Installed it. Not working ! Error (short):

11-17 23:58:54.029: E/dalvikvm(12370): dlopen("/data/data/org.kivy.pictures/files/lib/python2.7/lib-dynload/_sqlite3.so") failed: Cannot load library: load_library(linker.cpp:745): library "/data/data/org.kivy.pictures/files/lib/python2.7/lib-dynload/_sqlite3.so" not found
11-17 23:58:54.030: D/dalvikvm(12370): Trying to load lib /data/data/org.kivy.pictures/files/lib/python2.7/lib-dynload/_imaging.so 0x4218c5d0
11-17 23:58:54.030: E/dalvikvm(12370): dlopen("/data/data/org.kivy.pictures/files/lib/python2.7/lib-dynload/_imaging.so") failed: Cannot load library: load_library(linker.cpp:745): library "/data/data/org.kivy.pictures/files/lib/python2.7/lib-dynload/_imaging.so" not found

Long log:

11-17 23:57:08.947: I/ActivityManager(465): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=org.kivy.pictures cmp=org.kivy.pictures/org.renpy.android.PythonActivity} from pid 11197
11-17 23:57:09.046: V/ActivityManager(465): Broadcast: Intent { act=android.intent.action.PACKAGE_FIRST_LAUNCH dat=package:org.kivy.pictures flg=0x8000010 pkg=com.android.vending (has extras) } ordered=false userid=0
11-17 23:57:09.072: I/ActivityManager(465): Start proc org.kivy.pictures:python for activity org.kivy.pictures/org.renpy.android.PythonActivity: pid=12044 uid=10168 gids={50168, 1015, 1028}
11-17 23:57:09.415: V/ActivityManager(465): Binding process pid 12044 to record ProcessRecord{4285d090 12044:org.kivy.pictures:python/u0a10168}
11-17 23:57:09.418: V/ActivityManager(465): New app record ProcessRecord{4285d090 12044:org.kivy.pictures:python/u0a10168} thread=android.os.BinderProxy@4261abb0 pid=12044
11-17 23:57:09.458: V/ActivityManager(465): ACT-Launching: ActivityRecord{421c6ed0 u0 org.kivy.pictures/org.renpy.android.PythonActivity}
11-17 23:57:12.686: V/WindowManager(465): Changing focus from null to Window{42911728 u0 org.kivy.pictures/org.renpy.android.PythonActivity}
11-17 23:57:12.698: I/WindowManager(465): Gaining focus: Window{42911728 u0 org.kivy.pictures/org.renpy.android.PythonActivity}
11-17 23:57:13.614: V/ActivityManager(465): Activity idle: Token{426d2130 ActivityRecord{421c6ed0 u0 org.kivy.pictures/org.renpy.android.PythonActivity}}
11-17 23:57:32.516: I/ActivityManager(465): Start proc org.fdroid.fdroid for broadcast org.fdroid.fdroid/.receiver.PackageAddedReceiver: pid=12234 uid=10121 gids={50121, 3003, 3002, 3001, 1015, 1028}
11-17 23:57:32.592: V/ActivityManager(465): Binding process pid 12234 to record ProcessRecord{42d3d180 12234:org.fdroid.fdroid/u0a10121}
11-17 23:57:32.594: V/ActivityManager(465): New app record ProcessRecord{42d3d180 12234:org.fdroid.fdroid/u0a10121} thread=android.os.BinderProxy@42a1e630 pid=12234
11-17 23:57:33.770: I/ActivityManager(465): Process org.kivy.pictures:python (pid 12044) has died.
11-17 23:57:33.865: W/ActivityManager(465): Force removing ActivityRecord{421c6ed0 u0 org.kivy.pictures/org.renpy.android.PythonActivity}: app died, no saved state
11-17 23:57:33.875: I/WindowState(465): WIN DEATH: Window{42911728 u0 org.kivy.pictures/org.renpy.android.PythonActivity}
11-17 23:57:33.879: V/WindowManager(465): Changing focus from Window{42911728 u0 org.kivy.pictures/org.renpy.android.PythonActivity} to null
11-17 23:57:33.879: I/WindowManager(465): Losing focus: Window{42911728 u0 org.kivy.pictures/org.renpy.android.PythonActivity}
11-17 23:57:44.937: I/wifi(465): ssid=ingiborgi
11-17 23:58:44.969: I/wifi(465): ssid=ingiborgi
11-17 23:58:53.686: I/ActivityManager(465): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=org.kivy.pictures cmp=org.kivy.pictures/org.renpy.android.PythonActivity} from pid 11197
11-17 23:58:53.799: I/ActivityManager(465): Start proc org.kivy.pictures:python for activity org.kivy.pictures/org.renpy.android.PythonActivity: pid=12370 uid=10168 gids={50168, 1015, 1028}
11-17 23:58:53.823: V/ActivityManager(465): Binding process pid 12370 to record ProcessRecord{42991c58 12370:org.kivy.pictures:python/u0a10168}
11-17 23:58:53.825: V/ActivityManager(465): New app record ProcessRecord{42991c58 12370:org.kivy.pictures:python/u0a10168} thread=android.os.BinderProxy@42b6b4d0 pid=12370
11-17 23:58:53.873: V/ActivityManager(465): ACT-Launching: ActivityRecord{42bf5658 u0 org.kivy.pictures/org.renpy.android.PythonActivity}
11-17 23:58:53.904: D/dalvikvm(12370): open_cached_dex_file : /data/app/org.kivy.pictures-1.apk /data/dalvik-cache/data@app@org.kivy.pictures-1.apk@classes.dex
11-17 23:58:53.948: D/dalvikvm(12370): Trying to load lib /data/app-lib/org.kivy.pictures-1/libsdl.so 0x4218c5d0
11-17 23:58:53.956: D/dalvikvm(12370): Added shared lib /data/app-lib/org.kivy.pictures-1/libsdl.so 0x4218c5d0
11-17 23:58:53.956: D/dalvikvm(12370): Trying to load lib /data/app-lib/org.kivy.pictures-1/libsdl_image.so 0x4218c5d0
11-17 23:58:53.959: D/dalvikvm(12370): Added shared lib /data/app-lib/org.kivy.pictures-1/libsdl_image.so 0x4218c5d0
11-17 23:58:53.960: D/dalvikvm(12370): No JNI_OnLoad found in /data/app-lib/org.kivy.pictures-1/libsdl_image.so 0x4218c5d0, skipping init
11-17 23:58:53.960: D/dalvikvm(12370): Trying to load lib /data/app-lib/org.kivy.pictures-1/libsdl_ttf.so 0x4218c5d0
11-17 23:58:53.967: D/dalvikvm(12370): Added shared lib /data/app-lib/org.kivy.pictures-1/libsdl_ttf.so 0x4218c5d0
11-17 23:58:53.967: D/dalvikvm(12370): No JNI_OnLoad found in /data/app-lib/org.kivy.pictures-1/libsdl_ttf.so 0x4218c5d0, skipping init
11-17 23:58:53.967: D/dalvikvm(12370): Trying to load lib /data/app-lib/org.kivy.pictures-1/libsdl_mixer.so 0x4218c5d0
11-17 23:58:53.973: D/dalvikvm(12370): Added shared lib /data/app-lib/org.kivy.pictures-1/libsdl_mixer.so 0x4218c5d0
11-17 23:58:53.973: D/dalvikvm(12370): No JNI_OnLoad found in /data/app-lib/org.kivy.pictures-1/libsdl_mixer.so 0x4218c5d0, skipping init
11-17 23:58:53.974: D/dalvikvm(12370): Trying to load lib /data/app-lib/org.kivy.pictures-1/libpython2.7.so 0x4218c5d0
11-17 23:58:53.977: V/WindowManager(465): Changing focus from null to Window{42cf28a8 u0 org.kivy.pictures/org.renpy.android.PythonActivity}
11-17 23:58:53.990: D/dalvikvm(12370): Added shared lib /data/app-lib/org.kivy.pictures-1/libpython2.7.so 0x4218c5d0
11-17 23:58:53.990: D/dalvikvm(12370): No JNI_OnLoad found in /data/app-lib/org.kivy.pictures-1/libpython2.7.so 0x4218c5d0, skipping init
11-17 23:58:53.990: D/dalvikvm(12370): Trying to load lib /data/app-lib/org.kivy.pictures-1/libapplication.so 0x4218c5d0
11-17 23:58:53.994: D/dalvikvm(12370): Added shared lib /data/app-lib/org.kivy.pictures-1/libapplication.so 0x4218c5d0
11-17 23:58:54.000: D/dalvikvm(12370): No JNI_OnLoad found in /data/app-lib/org.kivy.pictures-1/libapplication.so 0x4218c5d0, skipping init
11-17 23:58:54.000: D/dalvikvm(12370): Trying to load lib /data/app-lib/org.kivy.pictures-1/libsdl_main.so 0x4218c5d0
11-17 23:58:54.002: D/dalvikvm(12370): Added shared lib /data/app-lib/org.kivy.pictures-1/libsdl_main.so 0x4218c5d0
11-17 23:58:54.003: D/dalvikvm(12370): No JNI_OnLoad found in /data/app-lib/org.kivy.pictures-1/libsdl_main.so 0x4218c5d0, skipping init
11-17 23:58:54.004: D/dalvikvm(12370): Trying to load lib /data/data/org.kivy.pictures/files/lib/python2.7/lib-dynload/_io.so 0x4218c5d0
11-17 23:58:54.016: D/dalvikvm(12370): Added shared lib /data/data/org.kivy.pictures/files/lib/python2.7/lib-dynload/_io.so 0x4218c5d0
11-17 23:58:54.016: D/dalvikvm(12370): No JNI_OnLoad found in /data/data/org.kivy.pictures/files/lib/python2.7/lib-dynload/_io.so 0x4218c5d0, skipping init
11-17 23:58:54.016: D/dalvikvm(12370): Trying to load lib /data/data/org.kivy.pictures/files/lib/python2.7/lib-dynload/unicodedata.so 0x4218c5d0
11-17 23:58:54.019: D/dalvikvm(12370): Added shared lib /data/data/org.kivy.pictures/files/lib/python2.7/lib-dynload/unicodedata.so 0x4218c5d0
11-17 23:58:54.021: D/dalvikvm(12370): No JNI_OnLoad found in /data/data/org.kivy.pictures/files/lib/python2.7/lib-dynload/unicodedata.so 0x4218c5d0, skipping init
11-17 23:58:54.021: D/dalvikvm(12370): Trying to load lib /data/app-lib/org.kivy.pictures-1/libsqlite3.so 0x4218c5d0
11-17 23:58:54.022: I/WindowManager(465): Gaining focus: Window{42cf28a8 u0 org.kivy.pictures/org.renpy.android.PythonActivity}
11-17 23:58:54.029: D/dalvikvm(12370): Added shared lib /data/app-lib/org.kivy.pictures-1/libsqlite3.so 0x4218c5d0
11-17 23:58:54.029: D/dalvikvm(12370): No JNI_OnLoad found in /data/app-lib/org.kivy.pictures-1/libsqlite3.so 0x4218c5d0, skipping init
11-17 23:58:54.029: D/dalvikvm(12370): Trying to load lib /data/data/org.kivy.pictures/files/lib/python2.7/lib-dynload/_sqlite3.so 0x4218c5d0
11-17 23:58:54.029: E/dalvikvm(12370): dlopen("/data/data/org.kivy.pictures/files/lib/python2.7/lib-dynload/_sqlite3.so") failed: Cannot load library: load_library(linker.cpp:745): library "/data/data/org.kivy.pictures/files/lib/python2.7/lib-dynload/_sqlite3.so" not found
11-17 23:58:54.030: D/dalvikvm(12370): Trying to load lib /data/data/org.kivy.pictures/files/lib/python2.7/lib-dynload/_imaging.so 0x4218c5d0
11-17 23:58:54.030: E/dalvikvm(12370): dlopen("/data/data/org.kivy.pictures/files/lib/python2.7/lib-dynload/_imaging.so") failed: Cannot load library: load_library(linker.cpp:745): library "/data/data/org.kivy.pictures/files/lib/python2.7/lib-dynload/_imaging.so" not found
11-17 23:58:54.107: V/SurfaceView(12370): org.renpy.android.SDLSurfaceView{421911f8 V.E..... ......ID 0,0-800,1183} got resized: w=800 h=1183, cur w=-1 h=-1
11-17 23:58:54.219: I/ActivityManager(465): [AppLaunch] Displayed Displayed org.kivy.pictures/org.renpy.android.PythonActivity: +438ms
11-17 23:58:54.219: D/ActivityManager(465): AP_PROF:AppLaunch_LaunchTime:org.kivy.pictures/org.renpy.android.PythonActivity:438:173218105
11-17 23:58:54.304: V/InputMethodManager(12370): START INPUT: org.renpy.android.SDLSurfaceView{421911f8 VFE..... .F...... 0,0-800,1183} ic=org.renpy.android.SDLSurfaceView$3@422a6280 tba=android.view.inputmethod.EditorInfo@422a59a0 controlFlags=#100
11-17 23:58:54.307: V/ActivityManager(465): Activity idle: Token{42b2f9d8 ActivityRecord{42bf5658 u0 org.kivy.pictures/org.renpy.android.PythonActivity}}
11-17 23:58:54.609: I/python(12370): ['/data/data/org.kivy.pictures/files/lib/python2.7/site-packages', '/data/data/org.kivy.pictures/files/lib/site-python']
11-17 23:58:54.609: I/python(12370): Android path ['/data/data/org.kivy.pictures/files/lib/python27.zip', '/data/data/org.kivy.pictures/files/lib/python2.7', '/data/data/org.kivy.pictures/files/lib/python2.7/lib-dynload', '/data/data/org.kivy.pictures/files/lib/python2.7/site-packages', '/data/data/org.kivy.pictures/files']
11-17 23:58:54.736: D/ActivityManager(465): ACT-IDLE_NOW_MSG from windowsVisible() for idle: ActivityRecord{42bf5658 u0 org.kivy.pictures/org.renpy.android.PythonActivity}
11-17 23:58:55.122: I/python(12370): [INFO              ] [Logger      ] Record log in /data/data/org.kivy.pictures/files/.kivy/logs/kivy_16-11-17_1.txt
11-17 23:58:56.896: I/python(12370):  /data/data/org.kivy.pictures/files/lib/python2.7/site-packages/kivy/core/image/img_pygame.py:13: RuntimeWarning: import cdrom: No module named cdrom
11-17 23:58:59.750: W/InputDispatcher(465): channel '42cf28a8 org.kivy.pictures/org.renpy.android.PythonActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
11-17 23:58:59.750: E/InputDispatcher(465): channel '42cf28a8 org.kivy.pictures/org.renpy.android.PythonActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
11-17 23:58:59.751: I/ActivityManager(465): Process org.kivy.pictures:python (pid 12370) has died.
11-17 23:58:59.751: W/ActivityManager(465): Force removing ActivityRecord{42bf5658 u0 org.kivy.pictures/org.renpy.android.PythonActivity}: app died, no saved state
11-17 23:58:59.755: I/WindowState(465): WIN DEATH: Window{42cf28a8 u0 org.kivy.pictures/org.renpy.android.PythonActivity}
11-17 23:58:59.755: W/InputDispatcher(465): Attempted to unregister already unregistered input channel '42cf28a8 org.kivy.pictures/org.renpy.android.PythonActivity (server)'
11-17 23:58:59.758: V/WindowManager(465): Changing focus from Window{42cf28a8 u0 org.kivy.pictures/org.renpy.android.PythonActivity} to null
11-17 23:58:59.760: I/WindowManager(465): Losing focus: Window{42cf28a8 u0 org.kivy.pictures/org.renpy.android.PythonActivity}
11-17 23:59:45.109: I/wifi(465): ssid=ingiborgi
11-18 00:00:07.276: I/ActivityManager(465): No longer want org.test.picture_viewer.picture_viewer (pid 11745): empty #18
11-18 00:00:12.675: D/skia(11197): skiaWebpDecoder:: org:w 192, h 192, out:192 192, decBuf 192 192, sample 1!!
11-18 00:00:12.727: D/skia(11197): skiaWebpDecoder:: org:w 192, h 192, out:192 192, decBuf 192 192, sample 1!!
11-18 00:00:12.770: D/skia(11197): skiaWebpDecoder:: org:w 192, h 192, out:192 192, decBuf 192 192, sample 1!!
11-18 00:00:12.796: D/skia(11197): skiaWebpDecoder:: org:w 192, h 192, out:192 192, decBuf 192 192, sample 1!!
11-18 00:00:12.832: D/skia(11197): skiaWebpDecoder:: org:w 192, h 192, out:192 192, decBuf 192 192, sample 1!!
11-18 00:00:12.876: D/skia(11197): skiaWebpDecoder:: org:w 192, h 192, out:192 192, decBuf 192 192, sample 1!!
11-18 00:00:12.951: D/skia(11197): skiaWebpDecoder:: org:w 192, h 192, out:192 192, decBuf 192 192, sample 1!!
11-18 00:00:13.002: D/skia(11197): skiaWebpDecoder:: org:w 192, h 192, out:192 192, decBuf 192 192, sample 1!!
11-18 00:00:13.100: D/skia(11197): skiaWebpDecoder:: org:w 192, h 192, out:192 192, decBuf 192 192, sample 1!!
11-18 00:00:13.130: D/skia(11197): skiaWebpDecoder:: org:w 350, h 197, out:350 197, decBuf 350 197, sample 1!!
11-18 00:00:13.161: D/skia(11197): skiaWebpDecoder:: org:w 78, h 78, out:78 78, decBuf 78 78, sample 1!!
11-18 00:00:45.178: I/wifi(465): ssid=ingiborgi
11-18 00:01:45.112: I/wifi(465): ssid=ingiborgi
11-18 00:01:49.968: D/wpa_supplicant(24293): wlan0: BSS: Remove id 854 BSSID 90:8d:78:b8:12:c6 SSID 'ingiborgi' due to wpa_bss_flush_by_age

Maybe it is my device or soft on it has some bugs (but earlier I could to compile apk without errors, about a year ago)? ASUS me173x, android 4.2.2

KeyWeeUsr commented 7 years ago

Downloaded the same example (KivyPictures) and it works without problems. I have 4.4.2 too. Reading the specs of your device and comparing with mine there's only SDK difference (you have higher needed one or something).

Also, I work with the Crystax NDK now, but when I worked with pygame launcher, I used r8c version of classic NDK. NDK is responsible for compiling if I remember correctly, so there might be the issue too? (bad compilation)

Clean the p4a builds and dists (should be enough now) and when building, increase the switch --android-api to --android-api 19, that seems to be used even in tests. I won't tell you to dowload Crystax, that beast is huge, yet it might help.

To test if you might want to use Crystax, install this custom test app. If it runs, it's most likely able to load libsqlite3.so. Then test importing sqlite3 with the button. If it still doesn't crash, Crystax is a way to go.

nesergen commented 7 years ago

I have a question about build-options: 'android-api' and 'minsdk'. Android api - it is clear. But for 'minsdk' I need to set the api number or the sdk-revision-number ?

nesergen commented 7 years ago

crystax NDK work, but on device raise an error:

11-21 02:42:57.213: E/InstalledAppDetails(7778): Exception when retrieving package:org.test.testapp_setup
11-21 02:42:57.213: E/InstalledAppDetails(7778): android.content.pm.PackageManager$NameNotFoundException: org.test.testapp_setup
11-21 02:42:57.337: W/AppSecurityPermissions(7778): Couldn't retrieve permissions for package:org.test.testapp_setup
11-21 02:42:57.371: V/NotificationService(455): notifications are enabled for org.test.testapp_setup
11-21 02:42:57.671: W/PackageManager(455): Package named 'org.test.testapp_setup' doesn't exist.
11-21 02:42:59.658: I/ActivityManager(455): No longer want org.fdroid.fdroid (pid 7841): empty #17
11-21 02:43:00.551: D/ThemeReceiver(7778): delete theme: org.kivy.testlauncher_pygame
11-21 02:43:00.572: V/com.android.systemui.QuickTool.QuickToolBroadcastReciever(572): DELETE PKG : org.kivy.testlauncher_pygame
11-21 02:43:00.613: I/Finsky(4260): [1] com.google.android.finsky.wear.WearSupportService.a(307): Wear auto uninstall disabled for package org.kivy.testlauncher_pygame
11-21 02:43:00.671: I/LocationSettingsChecker(18305): Removing dialog suppression flag for package org.kivy.testlauncher_pygame
11-21 02:43:00.789: I/Icing(18305): doRemovePackageData org.kivy.testlauncher_pygame
11-21 02:43:00.912: I/UpdateIcingCorporaServi(1451): Updating corpora: APPS=org.kivy.testlauncher_pygame, CONTACTS=MAYBE
11-21 02:43:00.994: I/ActivityManager(455): Start proc org.fdroid.fdroid for broadcast org.fdroid.fdroid/.receiver.PackageRemovedReceiver: pid=8771 uid=10121 gids={50121, 3003, 3002, 3001, 1015, 1028}
11-21 02:43:01.035: V/ActivityManager(455): Binding process pid 8771 to record ProcessRecord{41e6a2d0 8771:org.fdroid.fdroid/u0a10121}
11-21 02:43:01.037: V/ActivityManager(455): New app record ProcessRecord{41e6a2d0 8771:org.fdroid.fdroid/u0a10121} thread=android.os.BinderProxy@421aa200 pid=8771
11-21 02:43:01.067: D/dalvikvm(8771): open_cached_dex_file : /data/app/org.fdroid.fdroid-2.apk /data/dalvik-cache/data@app@org.fdroid.fdroid-2.apk@classes.dex
11-21 02:43:01.301: E/dalvikvm(8771): Could not find class 'android.bluetooth.BluetoothManager', referenced from method org.fdroid.fdroid.FDroidApp.getBluetoothAdapter
11-21 02:43:01.301: W/dalvikvm(8771): VFY: unable to resolve check-cast 45 (Landroid/bluetooth/BluetoothManager;) in Lorg/fdroid/fdroid/FDroidApp;
11-21 02:43:01.556: D/SQLiteConnection(18305): executeForChangedRowCount took 634ms - succeeded, sql="DELETE FROM event_filters WHERE app_id=?", bindArgs=["org.kivy.testlauncher_pygame"], changedRows=0
11-21 02:43:01.559: D/SQLiteConnection(18305): executeForCursorWindow took 614ms - succeeded, sql="SELECT external_game_id FROM game_instances JOIN games ON instance_game_id=games._id WHERE (package_name=?)", bindArgs=["org.kivy.testlauncher_pygame"], window='/data/data/com.google.android.gms/databases/games_80157553.db {5c7d7268}', startPos=0, actualPos=0, filledRows=0, countedRows=0
11-21 02:43:01.605: D/ACRA(8771): ACRA is enabled for org.fdroid.fdroid, initializing...
11-21 02:43:01.607: W/ACRA(8771): org.fdroid.fdroid reports will be sent by email (if accepted by user).
11-21 02:43:01.610: D/ACRA(8771): Looking for error files in /data/data/org.fdroid.fdroid/files
11-21 02:43:01.612: D/ACRA(8771): Looking for error files in /data/data/org.fdroid.fdroid/files
11-21 02:43:03.590: D/CMC->DemoAppUninstallReceiver(6901): onReceive() action:android.intent.action.PACKAGE_REMOVED package:org.test.testapp_setup
11-21 02:43:03.646: D/VoicemailCleanupService(5844): Cleaning up data for package: org.test.testapp_setup
11-21 02:43:04.645: D/ThemeReceiver(7778): delete theme: org.test.testapp_setup
11-21 02:43:04.660: V/com.android.systemui.QuickTool.QuickToolBroadcastReciever(572): DELETE PKG : org.test.testapp_setup
11-21 02:43:04.678: I/Finsky(4260): [1] com.google.android.finsky.wear.WearSupportService.a(307): Wear auto uninstall disabled for package org.test.testapp_setup
11-21 02:43:04.720: I/LocationSettingsChecker(18305): Removing dialog suppression flag for package org.test.testapp_setup
11-21 02:43:04.912: E/WorkSourceUtil(18305): Could not find package: org.test.testapp_setup
11-21 02:43:04.925: I/Icing(18305): doRemovePackageData org.test.testapp_setup
11-21 02:43:05.158: W/PackageManager(455): Package named 'org.kivy.testlauncher_pygame' doesn't exist.
11-21 02:43:05.223: W/PackageManager(455): Package named 'org.kivy.testlauncher_sdl2' doesn't exist.
11-21 02:43:05.254: I/UpdateIcingCorporaServi(1451): Updating corpora: APPS=org.test.testapp_setup, CONTACTS=MAYBE
11-21 02:43:05.500: D/VoldConnector(455): SND -> {27 asec fspath org.test.picture_viewer.picture_viewer-2}
11-21 02:43:05.501: D/FrameworkListener(116): dispatchCommand data = (27 asec fspath org.test.picture_viewer.picture_viewer-2)
11-21 02:43:05.504: D/VoldCmdListener(116): asec fspath org.test.picture_viewer.picture_viewer-2
11-21 02:43:05.505: D/SocketClient(116): SocketClient msg = /mnt/secure/asec/org.test.picture_viewer.picture_viewer-2.asec
11-21 02:43:05.505: D/SocketClient(116): SocketClient sendDatalocked done: 211 27 /mnt/secure/asec/org.test.picture_viewer.picture_viewer-2.asec
11-21 02:43:05.506: D/VoldConnector(455): RCV <- {211 27 /mnt/secure/asec/org.test.picture_viewer.picture_viewer-2.asec}
11-21 02:43:05.507: D/VoldConnector(455): RMV <- {211 27 /mnt/secure/asec/org.test.picture_viewer.picture_viewer-2.asec}
11-21 02:43:09.830: D/dalvikvm(8966): threadid=11 (RefQueueWorker@org.apache.http.impl.conn.tsccm.ConnPoolByRoute@413c8230): calling run()
11-21 02:43:09.867: D/dalvikvm(8966): threadid=12 (RefQueueWorker@org.apache.http.impl.conn.tsccm.ConnPoolByRoute@413d0178): calling run()
11-21 02:43:10.730: I/PackageManager(455): Start installation for package: org.kivy.testlauncher_sdl2
11-21 02:43:11.842: I/PackageManager(455): Perform pre-dex opt for package: org.kivy.testlauncher_sdl2
11-21 02:43:11.842: D/dalvikvm(455): open_cached_dex_file : /data/app/org.kivy.testlauncher_sdl2-1.apk /data/dalvik-cache/data@app@org.kivy.testlauncher_sdl2-1.apk@classes.dex
11-21 02:43:11.843: I/PackageManager(455): Running dexopt on: org.kivy.testlauncher_sdl2
11-21 02:43:12.024: D/dalvikvm(8966): threadid=26 (RefQueueWorker@org.apache.http.impl.conn.tsccm.ConnPoolByRoute@414c00a0): calling run()
11-21 02:43:12.025: D/dalvikvm(8966): threadid=27 (RefQueueWorker@org.apache.http.impl.conn.tsccm.ConnPoolByRoute@414c14b0): calling run()
11-21 02:43:12.032: D/dalvikvm(8966): threadid=29 (RefQueueWorker@org.apache.http.impl.conn.tsccm.ConnPoolByRoute@414c2e58): calling run()
11-21 02:43:12.047: I/PackageManager(455): Dexopt done on: org.kivy.testlauncher_sdl2
11-21 02:43:12.047: I/ActivityManager(455): Force stopping package org.kivy.testlauncher_sdl2 appid=10142 user=-1
11-21 02:43:12.212: D/PackageManager(455): New package installed in /data/app/org.kivy.testlauncher_sdl2-1.apk
11-21 02:43:12.234: W/PackageManager(455): Unknown permission android.permission.BODY_SENSORS in package org.kivy.testlauncher_sdl2
11-21 02:43:12.234: W/PackageManager(455): Unknown permission android.permission.USE_FINGERPRINT in package org.kivy.testlauncher_sdl2
11-21 02:43:12.372: I/PackageManager(455): Installation done for package: org.kivy.testlauncher_sdl2
11-21 02:43:12.458: V/ActivityManager(455): Broadcast: Intent { act=android.intent.action.PACKAGE_ADDED dat=package:org.kivy.testlauncher_sdl2 flg=0x8000010 (has extras) } ordered=false userid=0
11-21 02:43:12.482: D/Launcher.Model(746): onReceive intent=Intent { act=android.intent.action.PACKAGE_ADDED dat=package:org.kivy.testlauncher_sdl2 flg=0x8000010 (has extras) }
11-21 02:43:12.483: D/Launcher.Model(746): mAllAppsList.addPackage org.kivy.testlauncher_sdl2
11-21 02:43:13.345: V/AppWidgetServiceImpl(455): widget package name: org.ebookdroid Permission: -1
11-21 02:43:13.345: V/AppWidgetServiceImpl(455): widget package name: org.geometerplus.zlibrary.ui.android Permission: -1
11-21 02:43:19.356: I/Finsky(4260): [1] com.google.android.finsky.utils.bj.run(2299): Package state data is missing for org.kivy.testlauncher_sdl2
11-21 02:43:19.530: I/UpdateIcingCorporaServi(1451): Updating corpora: APPS=org.kivy.testlauncher_sdl2, CONTACTS=MAYBE
11-21 02:43:27.332: I/ActivityManager(455): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.kivy.testlauncher_sdl2/org.kivy.android.ProjectChooser} from pid 746
11-21 02:43:27.388: V/ActivityManager(455): org.kivy.testlauncher_sdl2/org.kivy.android.ProjectChooser: task=TaskRecord{41fd5e70 #29 A org.kivy.testlauncher_sdl2 U 0}
11-21 02:43:27.442: I/ActivityManager(455): Start proc org.kivy.testlauncher_sdl2 for activity org.kivy.testlauncher_sdl2/org.kivy.android.ProjectChooser: pid=9221 uid=10142 gids={50142, 1015, 3002, 1006, 3003, 1028}
11-21 02:43:27.505: V/ActivityManager(455): Binding process pid 9221 to record ProcessRecord{41d94338 9221:org.kivy.testlauncher_sdl2/u0a10142}
11-21 02:43:27.506: V/ActivityManager(455): New app record ProcessRecord{41d94338 9221:org.kivy.testlauncher_sdl2/u0a10142} thread=android.os.BinderProxy@414d81a8 pid=9221
11-21 02:43:27.507: V/ActivityManager(455): ACT-Launching: ActivityRecord{41574638 u0 org.kivy.testlauncher_sdl2/org.kivy.android.ProjectChooser}
11-21 02:43:27.547: D/dalvikvm(9221): open_cached_dex_file : /data/app/org.kivy.testlauncher_sdl2-1.apk /data/dalvik-cache/data@app@org.kivy.testlauncher_sdl2-1.apk@classes.dex
11-21 02:43:27.716: V/WindowManager(455): Changing focus from null to Window{41dbca18 u0 org.kivy.testlauncher_sdl2/org.kivy.android.ProjectChooser}
11-21 02:43:27.722: I/WindowManager(455): Gaining focus: Window{41dbca18 u0 org.kivy.testlauncher_sdl2/org.kivy.android.ProjectChooser}
11-21 02:43:28.191: I/ActivityManager(455): [AppLaunch] Displayed Displayed org.kivy.testlauncher_sdl2/org.kivy.android.ProjectChooser: +774ms
11-21 02:43:28.191: D/ActivityManager(455): AP_PROF:AppLaunch_LaunchTime:org.kivy.testlauncher_sdl2/org.kivy.android.ProjectChooser:774:71507701
11-21 02:43:28.226: V/ActivityManager(455): Activity idle: Token{4252a968 ActivityRecord{41574638 u0 org.kivy.testlauncher_sdl2/org.kivy.android.ProjectChooser}}
11-21 02:43:32.034: I/ActivityManager(455): START u0 {act=org.kivy.LAUNCH dat=kivy:/storage/emulated/0/kivy/trade_sql cmp=org.kivy.testlauncher_sdl2/org.kivy.android.PythonActivity} from pid 9221
11-21 02:43:32.077: V/WindowManager(455): Changing focus from Window{41dbca18 u0 org.kivy.testlauncher_sdl2/org.kivy.android.ProjectChooser} to null
11-21 02:43:32.078: I/WindowManager(455): Losing focus: Window{41dbca18 u0 org.kivy.testlauncher_sdl2/org.kivy.android.ProjectChooser}
11-21 02:43:32.079: V/ActivityManager(455): org.kivy.testlauncher_sdl2/org.kivy.android.PythonActivity: task=TaskRecord{41fd5e70 #29 A org.kivy.testlauncher_sdl2 U 0}
11-21 02:43:32.079: V/ActivityManager(455): org.kivy.testlauncher_sdl2/org.kivy.android.ProjectChooser: task=TaskRecord{41fd5e70 #29 A org.kivy.testlauncher_sdl2 U 0}
11-21 02:43:32.084: V/ActivityManager(455): ACT-Launching: ActivityRecord{41708608 u0 org.kivy.testlauncher_sdl2/org.kivy.android.PythonActivity}
11-21 02:43:35.963: D/dalvikvm(9323): threadid=19 (RefQueueWorker@org.apache.http.impl.conn.tsccm.ConnPoolByRoute@41a42918): calling run()
11-21 02:43:38.296: D/dalvikvm(9221): Trying to load lib /data/app-lib/org.kivy.testlauncher_sdl2-1/libSDL2.so 0x4139d1a0
11-21 02:43:38.296: E/dalvikvm(9221): dlopen("/data/app-lib/org.kivy.testlauncher_sdl2-1/libSDL2.so") failed: Cannot load library: soinfo_link_image(linker.cpp:1635): could not load library "libcrystax.so" needed by "libSDL2.so"; caused by load_library(linker.cpp:745): library "libcrystax.so" not found
11-21 02:43:38.382: V/WindowManager(455): Changing focus from null to Window{42174650 u0 org.kivy.testlauncher_sdl2/org.kivy.android.PythonActivity}
11-21 02:43:38.383: I/WindowManager(455): Gaining focus: Window{42174650 u0 org.kivy.testlauncher_sdl2/org.kivy.android.PythonActivity}
11-21 02:43:38.388: W/dalvikvm(9221): No implementation found for native Lorg/libsdl/app/SDLActivity;.nativeSetEnv:(Ljava/lang/String;Ljava/lang/String;)V
11-21 02:43:38.390: E/AndroidRuntime(9221): java.lang.UnsatisfiedLinkError: Native method not found: org.libsdl.app.SDLActivity.nativeSetEnv:(Ljava/lang/String;Ljava/lang/String;)V
11-21 02:43:38.390: E/AndroidRuntime(9221):     at org.libsdl.app.SDLActivity.nativeSetEnv(Native Method)
11-21 02:43:38.390: E/AndroidRuntime(9221):     at org.kivy.android.PythonActivity.onCreate(PythonActivity.java:86)
11-21 02:43:38.398: W/ActivityManager(455):   Force finishing activity org.kivy.testlauncher_sdl2/org.kivy.android.PythonActivity
11-21 02:43:38.457: V/WindowManager(455): Changing focus from Window{42174650 u0 org.kivy.testlauncher_sdl2/org.kivy.android.PythonActivity} to Window{423459f8 u0 Application Error: org.kivy.testlauncher_sdl2}
11-21 02:43:38.459: I/WindowManager(455): Gaining focus: Window{423459f8 u0 Application Error: org.kivy.testlauncher_sdl2}
11-21 02:43:38.514: I/dalvikvm(9323): Could not find method org.slf4j.impl.StaticLoggerBinder.getSingleton, referenced from method org.a.c.a
11-21 02:43:38.514: W/dalvikvm(9323): VFY: unable to resolve static method 8029: Lorg/slf4j/impl/StaticLoggerBinder;.getSingleton ()Lorg/slf4j/impl/StaticLoggerBinder;
11-21 02:43:38.518: I/dalvikvm(9323): Could not find method org.slf4j.impl.StaticLoggerBinder.getSingleton, referenced from method org.a.c.c
11-21 02:43:38.518: W/dalvikvm(9323): VFY: unable to resolve static method 8029: Lorg/slf4j/impl/StaticLoggerBinder;.getSingleton ()Lorg/slf4j/impl/StaticLoggerBinder;
11-21 02:43:38.519: I/dalvikvm(9323): Could not find method org.slf4j.impl.StaticLoggerBinder.getSingleton, referenced from method org.a.c.c
11-21 02:43:38.519: W/dalvikvm(9323): VFY: unable to resolve static method 8029: Lorg/slf4j/impl/StaticLoggerBinder;.getSingleton ()Lorg/slf4j/impl/StaticLoggerBinder;
11-21 02:43:38.520: W/dalvikvm(9323): VFY: unable to resolve static field 2849 (REQUESTED_API_VERSION) in Lorg/slf4j/impl/StaticLoggerBinder;
11-21 02:43:38.523: W/System.err(9323): SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
11-21 02:43:38.523: W/System.err(9323): SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
11-21 02:43:38.536: D/AES(455):     process : org.kivy.testlauncher_sdl2
11-21 02:43:38.536: D/AES(455):      module : org.kivy.testlauncher_sdl2 v100 (1.0)
11-21 02:43:38.538: D/AEE/LIBAEE(455): shell: raise_exp(2, 9221, -1361051648, org.kivy.testlauncher_sdl2, 0x0x5cf49008, 0x0x0)
11-21 02:43:38.601: D/dalvikvm(9323): threadid=10 (RefQueueWorker@org.apache.http.impl.conn.tsccm.ConnPoolByRoute@41c50ea0): calling run()
11-21 02:43:38.902: W/ActivityManager(455): Activity pause timeout for ActivityRecord{41708608 u0 org.kivy.testlauncher_sdl2/org.kivy.android.PythonActivity}
11-21 02:43:38.903: V/ActivityManager(455): Enqueueing pending finish: ActivityRecord{41708608 u0 org.kivy.testlauncher_sdl2/org.kivy.android.PythonActivity}
11-21 02:43:39.112: V/ActivityManager(455): Stopping ActivityRecord{41574638 u0 org.kivy.testlauncher_sdl2/org.kivy.android.ProjectChooser}: nowVisible=false waitingVisible=true finishing=true
11-21 02:43:39.491: V/ActivityManager(455): Stopping ActivityRecord{41574638 u0 org.kivy.testlauncher_sdl2/org.kivy.android.ProjectChooser}: nowVisible=true waitingVisible=false finishing=true
11-21 02:43:39.491: V/ActivityManager(455): Ready to stop: ActivityRecord{41574638 u0 org.kivy.testlauncher_sdl2/org.kivy.android.ProjectChooser}
11-21 02:43:41.634: D/dalvikvm(9323): threadid=30 (RefQueueWorker@org.apache.http.impl.conn.tsccm.ConnPoolByRoute@41ba7150): calling run()
11-21 02:43:41.706: V/MediaProvider/DrmHelper(7121): pid=8771, name=org.fdroid.fdroid, allow=false
11-21 02:43:49.118: W/ActivityManager(455): Activity destroy timeout for ActivityRecord{41708608 u0 org.kivy.testlauncher_sdl2/org.kivy.android.PythonActivity}
11-21 02:43:49.122: V/ActivityManager(455): org.kivy.testlauncher_sdl2/org.kivy.android.ProjectChooser: task=TaskRecord{41fd5e70 #29 A org.kivy.testlauncher_sdl2 U 0}
11-21 02:43:49.496: W/ActivityManager(455): Activity destroy timeout for ActivityRecord{41574638 u0 org.kivy.testlauncher_sdl2/org.kivy.android.ProjectChooser}
nesergen commented 7 years ago

For experiment I have reinstalled all (Kivy , buildozer, cython, p4a). Old error is remained. In buildozer file I have checked the parameter:

# (list) Android additionnal libraries to copy into libs/armeabi
android.add_libs_armeabi = libs/android/*.so
android.add_libs_armeabi_v7a = libs/android-v7/*.so

But new issue appeared:

[INFO]:     picture_viewer: includes recipes (hostpython2, jpeg, png, sdl2_image, sdl2_mixer, sdl2_ttf, sqlite3, python2, pil, sdl2, six, pyjnius, kivy), built for archs (armeabi-v7a)
[INFO]:    picture_viewer has compatible recipes, using this one
# Build the application #2
# Copy application source from /home/sergen/PythonExp/kivy_exp/picture_viewer
# Create directory /home/sergen/PythonExp/kivy_exp/picture_viewer/.buildozer/android/app
# Copy /home/sergen/PythonExp/kivy_exp/picture_viewer/main.py
# Copy /home/sergen/PythonExp/kivy_exp/picture_viewer/shadow32.png
# Copy /home/sergen/PythonExp/kivy_exp/picture_viewer/my.kv
# Create directory /home/sergen/PythonExp/kivy_exp/picture_viewer/.buildozer/android/app/image
# Copy /home/sergen/PythonExp/kivy_exp/picture_viewer/image/20150128_084310.jpg
# Copy /home/sergen/PythonExp/kivy_exp/picture_viewer/image/1354371686_raznoobraznaya-podborka_1-34.jpg
# Copy /home/sergen/PythonExp/kivy_exp/picture_viewer/image/11111111.jpg
# Copy /home/sergen/PythonExp/kivy_exp/picture_viewer/image/20150128_084043.jpg
# Package the application
# Search and copy libs for armeabi
Traceback (most recent call last):
  File "/usr/local/bin/buildozer", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/buildozer/scripts/client.py", line 13, in main
    Buildozer().run_command(sys.argv[1:])
  File "/usr/local/lib/python2.7/dist-packages/buildozer/__init__.py", line 1020, in run_command
    self.target.run_commands(args)
  File "/usr/local/lib/python2.7/dist-packages/buildozer/target.py", line 90, in run_commands
    func(args)
  File "/usr/local/lib/python2.7/dist-packages/buildozer/target.py", line 102, in cmd_debug
    self.buildozer.build()
  File "/usr/local/lib/python2.7/dist-packages/buildozer/__init__.py", line 210, in build
    self.target.build_package()
  File "/usr/local/lib/python2.7/dist-packages/buildozer/targets/android.py", line 635, in build_package
    for fn in self.buildozer.file_matches(patterns):
TypeError: 'NoneType' object is not iterable

Why it is occure ?

KeyWeeUsr commented 7 years ago

But for 'minsdk' I need to set the api number or the sdk-revision-number ?

That's the same as android-api, but targets the minimum required one. I don't remember how does it work, but I think it uses the lowest one e.g. if minimum is 8 and android-api is 10, I think it'll use 8. I used it when I was working with pygame to target android 2.3 - 4.4 (api 8 - 14)

re the buildozer error: I think there should be a string, like in casual python -> android.add_libs_armeabi = "libs/android/*.so"

re the logcat error: Have you tried to use pygame? It built for me correctly and ran too, but that was like... few months ago and I tried only with casual SDK, not with crystax, but it should work anyway. The error is about missing .so files, probably a path issue or a badly compiled app.

Sorry for the delayed reply.

nesergen commented 7 years ago

Sorry for the delayed reply.

Thanks for answer. It is pleasant than somebody pay attention for my problem.

Have you tried to use pygame?

No. I do not know how to set pygame in buildozer. With p4a tried but some error occured too.

I have found presumptive reason of the error with *.so It is the old bug of android versions 4.1-4.3 http://stackoverflow.com/questions/32860294/android-load-library-failed http://stackoverflow.com/questions/28806373/android-4-2-ndk-library-loading-crash-load-librarylinker-cpp750-soinfo-l https://code.google.com/p/android/issues/detail?id=35962 But why it is appear only now this is the question !

One of the solutions is to use android API System.loadLibrary("library_name") in my program. I think that pyjnius must be used for this purpose with command

libs_load = autoclass('java.lang.System')
libs_load.loadLibrary("libsqlite3.so")

But I do not know where to place this code.

The second solution is to use java package ReLinker https://github.com/KeepSafe/ReLinker But it not compiled in jar-file. How to do it - I do not know (Python is the only language known to me).

KeyWeeUsr commented 7 years ago

Can't help you with .jars, but I think I might be able to help with the System call:

When you create a dist folder, navigate to similar path as it's here. It should be just dist/src/... until you reach this file. Then do try&except block with your System call and it might work. I'm not promising anything. If it's android bug (seems like that from their repo), then I see two things which we can do here:

yet I'm not quite sure how sqlite is loaded anyway. If this is the same thing as with ssl, it might work the same way in that .java file.

Edit: the dist folder is usually at .local/python-for-android/dists/<dist folder>

nesergen commented 7 years ago

Oh my god !!! It works ! Not fully , but applet not crashs !!!

I have included the "sqlite3" to the 13th line of PythonUtil.java

KeyWeeUsr commented 7 years ago

Good. If you manage to not break it with sqlite3 file and make it work in the end, feel free to make a pull request for sqlite, I think it'll be helpful 🍡

nesergen commented 7 years ago

Can`t to understand what is happening.... I can load sqlite3 with pyjnius :

autoclass('java.lang.System').loadLibrary("sqlite3")
autoclass('java.lang.System').load(curdir + "lib/python2.7/lib-dynload/_sqlite3.so")

But not with python:

import sqlite3 raise error

I/python  (10516):  Traceback (most recent call last):
I/python  (10516):    File "main.py", line 109, in <module>
I/python  (10516):      MyApp().run()
I/python  (10516):    File "/data/data/org.test.picture_viewer.picture_viewer_2/files/app/lib/python2.7/site-packages/kivy/app.py", line 802, in run
I/python  (10516):      root = self.build()
I/python  (10516):    File "main.py", line 81, in build
I/python  (10516):      import sqlite3
I/python  (10516):  ImportError: No module named sqlite3
I/python  (10516): Python for android ended.
I/DEBUG   (10538):     #00  pc 000beda2  /data/app-lib/org.test.picture_viewer.picture_viewer_2-2/libpython2.7.so (PyThreadState_New+93)
I/DEBUG   (10538):     #01  pc 000c90dd  /data/app-lib/org.test.picture_viewer.picture_viewer_2-2/libpython2.7.so (PyThread_acquire_lock+76)
I/DEBUG   (10538):          beebe3f4  550060e1  /data/app-lib/org.test.picture_viewer.picture_viewer_2-2/libpython2.7.so (PyThread_acquire_lock+80)
I/DEBUG   (10538):     #00  beebe410  571210a9  /data/data/org.test.picture_viewer.picture_viewer_2/files/app/lib/python2.7/site-packages/kivy/core/window/_window_sdl2.so
I/DEBUG   (10538):     #01  beebe410  571210a9  /data/data/org.test.picture_viewer.picture_viewer_2/files/app/lib/python2.7/site-packages/kivy/core/window/_window_sdl2.so
I/DEBUG   (10538):          beebe418  550bbbc4  /data/app-lib/org.test.picture_viewer.picture_viewer_2-2/libpython2.7.so
I/DEBUG   (10538):          beebe424  54ffc5a5  /data/app-lib/org.test.picture_viewer.picture_viewer_2-2/libpython2.7.so (PyGILState_Ensure+48)
I/DEBUG   (10538):          beebe434  571210b3  /data/data/org.test.picture_viewer.picture_viewer_2/files/app/lib/python2.7/site-packages/kivy/core/window/_window_sdl2.so
KeyWeeUsr commented 7 years ago

There's a difference between .so file and Python package. You loaded a library that can be loaded even with Java, yet with import the Python package isn't found - the .so file isn't probably on the path required by sqlite3 package to work correctly.

nesergen commented 7 years ago

I just wanted to say that android sees these libraries, then he is not guilty. Then where is the problemm .......?

KeyWeeUsr commented 7 years ago

I thought your issue was solved with placing sqlite to PythonUtil.java What is the problem now?

nesergen commented 7 years ago

python can`t do command: import sqlite3

KeyWeeUsr commented 7 years ago

I'm not sure what's hapenning, because in my compiled version there's only org.something/lib/libsqlite3.so file, not _sqlite3.so.

nesergen commented 7 years ago

It contained in lib/python2.7/lib-dynload/_sqlite3.so on device after install apk. But I do not know for what purpose.

andrewm41 commented 7 years ago

It seems that for some reason old android versions (4.1.2 for me) can't dynamically load .so libraries. A bare python is launching for the reason that it is forced to load in PythonUtil.java.

As for 05.02.2017 it is written so that when python2.7 fails to load it tries to load python3 module which doesn't exist for python2 app and throw exception for python3 module. With this behaviour it is hard to debug the problem when python2.7 module is not loading.

I suggest pull request which can help people with old android devices to realise the problem.

P.S. at the moment I don't know how to make old android to load libraries other way than force them to load in PythonUtil.java

icarito commented 7 years ago

I am experiencing the same issue, having tried several NDK/SDK combinations including Crystax. Varying errors depending on SDL/NDK, more or less like this:

D/houdini (13952): [13952] Open Native Library /data/data/org.somosazucar.jappy/lib/libpython2.7.so failed.
D/dalvikvm(13952): Trying to load lib /data/data/org.somosazucar.jappy/lib/libpython3.5m.so 0x41e33330
W/System.err(13952): Cannot load library: link_image[1891]:   120 could not load needed library 'libcrystax.so' for 'libpython3.5m.so' (load_library[1093]: Library 'libcrystax.so' not found)

That was with python3crystax

inclement commented 5 years ago

Closing as probably fixed by various corrections to library loading within the last couple of years.