question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Webview apps not working on Android

See original GitHub issue

Just tried the flask testapp with python2 and python3. Python 2 fails loading libpython2.7.so in werkzeug, while Python 3 fails at Py_Initialize in start.c.

Python 2:

01-31 20:27:37.704 20925 20967 I python  : [GCC 4.2.1 Compatible Android (4691093 based on r316199) Clang 6.0.2 (https://a
01-31 20:27:37.704 20925 20967 I python  : ('python path is', ['/data/data/org.test.testapp_flask2/files/app', '/data/user/0/org.test.testapp_flask2/files/app/_python_bundle/stdlib.zip', '/data/user/0/org.test.testapp_flask2/files/app/_python_bundle/modules', '/data/user/0/org.test.testapp_flask2/files/app/_python_bundle/site-packages'])
01-31 20:27:37.704 20925 20967 I python  : imported os
01-31 20:27:37.710 20925 20967 I python  : Traceback (most recent call last):
01-31 20:27:37.710 20925 20967 I python  :   File "/home/sandy/devel/python-for-android/testapps/build/bdist.android-armeabi-v7a/testapp_flask/main.py", line 11, in <module>
01-31 20:27:37.710 20925 20967 I python  :   File "/home/sandy/.local/share/python-for-android/build/python-installs/testapp_flask/flask/__init__.py", line 17, in <module>
01-31 20:27:37.710 20925 20967 I python  :   File "/home/sandy/.local/share/python-for-android/build/python-installs/testapp_flask/werkzeug/__init__.py", line 20, in <module>
01-31 20:27:37.710 20925 20967 I python  :   File "/home/sandy/.local/share/python-for-android/build/python-installs/testapp_flask/werkzeug/_compat.py", line 5, in <module>
01-31 20:27:37.710 20925 20967 I python  : ImportError: dlopen failed: library "libpython2.7.so" not found
01-31 20:27:37.711 20925 20967 I python  : Python for android ended.

Python 3:

01-31 20:28:13.240 21005 21047 I python  : Initializing Python for Android
01-31 20:28:13.240 21005 21047 I python  : Setting additional env vars from p4a_env_vars.txt
01-31 20:28:13.240 21005 21047 I python  : Changing directory to the one provided by ANDROID_ARGUMENT
01-31 20:28:13.240 21005 21047 I python  : /data/user/0/org.test.testapp_flask/files/app
01-31 20:28:13.241 21005 21047 I python  : Preparing to initialize python
01-31 20:28:13.241 21005 21047 I python  : _python_bundle dir exists
01-31 20:28:13.241 21005 21047 I python  : calculated paths to be...
01-31 20:28:13.241 21005 21047 I python  : /data/user/0/org.test.testapp_flask/files/app/_python_bundle/stdlib.zip:/data/user/0/org.test.testapp_flask/files/app/_python_bundle/modules
01-31 20:28:13.241 21005 21047 I python  : set wchar paths...
01-31 20:28:13.241   430  1306 D BandwidthController: [LG DATA] No such appUid: 10392
01-31 20:28:13.241   430  1306 D DnsProxyListener: App 10392 tries DNS query. Accept family:0 protocol:0
01-31 20:28:13.242 21005 21043 W AudioCapabilities: Unsupported mime audio/x-lg-flac
01-31 20:28:13.243 21005 21043 W AudioCapabilities: Unsupported mime audio/adpcm
...
...
...
01-31 20:28:13.402 21005 21047 F libc    : Fatal signal 6 (SIGABRT), code -6 in tid 21047 (PythonThread)
01-31 20:28:13.402   458   560 E ThermalEngine: ACTION: CLUSTER - Setting CLUSTER[1] to 1632000
01-31 20:28:13.404   458   560 E ThermalEngine: ACTION: CLUSTER - Setting CLUSTER[1] to 1689600
01-31 20:28:13.412 21005 21043 I VideoCapabilities: Unsupported profile 4 for video/mp4v-es
01-31 20:28:13.420  1319  1467 I ActivityManager: Displayed org.test.testapp_flask/org.kivy.android.PythonActivity: +479ms
01-31 20:28:13.421  1319  1467 V WindowManager: Looking for focus: 25 = Window{29f1034 u0 StatusBar}, flags=-2122055608, canReceive=false
01-31 20:28:13.421  1319  1467 V WindowManager: findFocusedWindow: Found new focus @ 17 = Window{989de75 u0 org.test.testapp_flask/org.kivy.android.PythonActivity}
01-31 20:28:13.423  1319  1467 D InputDispatcher: Window went away: Window{7e46238 u0 Starting org.test.testapp_flask}
01-31 20:28:13.434 21005 21057 W cr_CrashFileManager: /data/user/0/org.test.testapp_flask/cache/WebView/Crash Reports does not exist or is not a directory
01-31 20:28:13.435   458   560 E ThermalEngine: ACTION: CLUSTER - Setting CLUSTER[1] to 1632000
01-31 20:28:13.453   431   431 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-31 20:28:13.453   431   431 F DEBUG   : Build fingerprint: 'lge/p1_global_com/p1:6.0/MRA58K/1809319266c01:user/release-keys'
01-31 20:28:13.453   431   431 F DEBUG   : Revision: '11'
01-31 20:28:13.453   431   431 F DEBUG   : ABI: 'arm'
01-31 20:28:13.453   431   431 F DEBUG   : pid: 21005, tid: 21047, name: PythonThread  >>> org.test.testapp_flask <<<
01-31 20:28:13.454   431   431 F DEBUG   : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
01-31 20:28:13.465   458   560 E ThermalEngine: ACTION: CLUSTER - Setting CLUSTER[1] to 1536000
01-31 20:28:13.470   431   431 F DEBUG   :     r0 00000000  r1 00005237  r2 00000006  r3 d907f978
01-31 20:28:13.470   431   431 F DEBUG   :     r4 d907f980  r5 d907f930  r6 00000000  r7 0000010c
01-31 20:28:13.470   431   431 F DEBUG   :     r8 00000002  r9 f3cbdf0a  sl d907f148  fp d907ee78
01-31 20:28:13.470   431   431 F DEBUG   :     ip 00000006  sp d907ee00  lr f74160ad  pc f7418190  cpsr 400f0010
01-31 20:28:13.472   431   431 F DEBUG   : 
01-31 20:28:13.472   431   431 F DEBUG   : backtrace:
01-31 20:28:13.472   431   431 F DEBUG   :     #00 pc 00042190  /system/lib/libc.so (tgkill+12)
01-31 20:28:13.472   431   431 F DEBUG   :     #01 pc 000400a9  /system/lib/libc.so (pthread_kill+32)
01-31 20:28:13.473   431   431 F DEBUG   :     #02 pc 0001c88f  /system/lib/libc.so (raise+10)
01-31 20:28:13.473   431   431 F DEBUG   :     #03 pc 00019a41  /system/lib/libc.so (__libc_android_abort+34)
01-31 20:28:13.473   431   431 F DEBUG   :     #04 pc 000175fc  /system/lib/libc.so (abort+4)
01-31 20:28:13.473   431   431 F DEBUG   :     #05 pc 001783e0  /data/app/org.test.testapp_flask-1/lib/arm/libpython3.7m.so

@opacam Are these expected to be working? For Python 2 it seems it may not know where to load libpython2.7.so from, which would be okay, but why is Python 3 failing at Py_Initialize even though everything seems to be set up properly?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
inclementcommented, Jan 31, 2019

Thanks @opacam, I’ll investigate my environment more before worrying too much about it.

0reactions
misl6commented, Jul 23, 2022

Closing as now the flask test app works fine onpython3 (python2 has been removed)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android system Webview update is crashing apps on my S22 ...
The Android system webview update has completely broken more than half of the apps on my S22 Ultra. (SM-S908U1). All of my apps...
Read more >
PSA: Update Android System WebView to fix crashing apps
Open the Play Store app · Search for “Android System WebView“ · Select Update. If it doesn't say “Update,” skip this step ·...
Read more >
Fix: Chrome and Android System Webview is not getting ...
Clear cache and Force stop the app. If an app is running in the background, then it is possible that it won't update....
Read more >
Fixed with update] Google confirms an issue with WebView is ...
If you're affected by the issue, open the Play Store, search for Android WebView, and uninstall the updates. Alternatively, you can also go...
Read more >
How to fix Android System WebView won't update issue?
Fix #1: Force Stop Webview App. · Fix #2: Do a soft restart. · Fix #3: Clear the Android System Webview Cache And...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found