simple flask app on android fails to start
See original GitHub issueThis is my main.py
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
if __name__ == '__main__':
app.run(port=5000)
And I use python-for-android apk --private ~/workspace/mobile/webview/ --package=org.example.myapp --name "test" --version 0.1 --bootstrap=webview --requirements=flask --port 5000
for creating the APK. when I run the app on Android 4.4.2:
logcat
stucks at V/python (13767): extracting _load.html
here:
V/python (13767): extracting lib/python2.7/lib-dynload/ V/python (13767): extracting lib/python2.7/lib-dynload/future_builtins.so V/python (13767): extracting lib/python2.7/lib-dynload/syslog.so V/python (13767): extracting lib/python2.7/lib-dynload/unicodedata.so V/python (13767): extracting lib/python2.7/lib-dynload/_ctypes.so V/python (13767): extracting lib/python2.7/lib-dynload/_csv.so V/python (13767): extracting lib/python2.7/lib-dynload/_io.so V/python (13767): extracting _load.html
and there is error shown on android device
Python Error
An error occurred while trying to load the application libraries. Please try again and/or reinstall.
Error: Couldn’t load main from loader dalvik.system.PathClassLoader[DexPathList[[zip file “/data/app/org/example.myapp-1.apk”],nativeLibraryDirectories=[/data/app-lib/org.example.myapp-1, /vendor/lib, /system/lib]]]: findLibrary returned null
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
I’ve just checked the flask build and it does work for me, so it seems p4a isn’t just broken right now.
Your error seems to relate to a failure to load libmain.so, which occurs before any of the python stuff really gets going - that’s why you don’t get a clear log when checking only python. I don’t know why the libmain load would fail though. You could locat the python-for-android dist dir that has been produced and check what is in its libs folder, just in case - it should be libmain.so and libpython2.7.so.
Closing in favour of https://github.com/kivy/python-for-android/issues/1644, which tracks the current issues with the webview bootstrap following the many recent changes.