Hello Everyone, I was just wondering how can I convert my flask app into a web view android app. I got py4a and give it a try.
After successful installation, I run python-for-android logcat and got this
[WARNING]: $ANDROIDNDKVER is deprecated and no longer necessary, the value you set is ignored
[INFO]: Found Android API target in $ANDROIDAPI: 28
[ERROR]: Build failed: Asked to build for armeabi architecture with API 28, but API 21 or greater does not support armeabi.
[INFO]: Instructions: You probably want to build with --arch=armeabi-v7a instead
I didn't understand what does it mean but I skip this error and use this
p4a apk --private /home/deviantpadam/recommender_system/ --package=deviant.myapp --name "Scholarly Articles Andoid" --version 0.1 --bootstrap=webview --requirements=python==3.7.5,Flask==1.1.1,gensim==3.8.0,h5py==2.10.0,Jinja2==2.11.1,numpy==1.18.1,pandas==1.0.3,SQLAlchemy==1.3.17,pickle5==0.0.10,cloudpickle==1.4.1,scikit-learn==0.22.1,scipy==1.4.1 ,category_encoders==2.2.2,lightgbm==2.3.1 --port=5000 --orientation sensor --debug
Now here is the Log,
[DEBUG]:
[DEBUG]: Python build finished successfully!
[DEBUG]: The necessary bits to build these optional modules were not found:
[DEBUG]: _dbm _gdbm _tkinter
[DEBUG]: nis spwd
[DEBUG]: To find the necessary bits, look in setup.py in detect_modules() for the module's name.
[DEBUG]:
[DEBUG]:
[DEBUG]: The following modules found by detect_modules() in setup.py, have been
[DEBUG]: built by the Makefile instead, as configured by the Setup files:
[DEBUG]: _abc atexit pwd
[DEBUG]: time
[DEBUG]:
[DEBUG]:
[DEBUG]: Failed to build these modules:
[DEBUG]: _crypt _curses _curses_panel
[DEBUG]: _uuid grp readline
[DEBUG]:
[DEBUG]: running build_scripts
[DEBUG]: creating build/scripts-3.8
[DEBUG]: copying and adjusting /home/deviantpadam/.local/share/python-for-android/build/other_builds/python3-libbz2-liblzma/armeabi-v7a__ndk_target_21/python3/Tools/scripts/pydoc3 -> build/scripts-3.8
[DEBUG]: copying and adjusting /home/deviantpadam/.local/share/python-for-android/build/other_builds/python3-libbz2-liblzma/armeabi-v7a__ndk_target_21/python3/Tools/scripts/idle3 -> build/scripts-3.8
[DEBUG]: copying and adjusting /home/deviantpadam/.local/share/python-for-android/build/other_builds/python3-libbz2-liblzma/armeabi-v7a__ndk_target_21/python3/Tools/scripts/2to3 -> build/scripts-3.8
[DEBUG]: changing mode of build/scripts-3.8/pydoc3 from 664 to 775
[DEBUG]: changing mode of build/scripts-3.8/idle3 from 664 to 775
[DEBUG]: changing mode of build/scripts-3.8/2to3 from 664 to 775
[DEBUG]: renaming build/scripts-3.8/pydoc3 to build/scripts-3.8/pydoc3.8
[DEBUG]: renaming build/scripts-3.8/idle3 to build/scripts-3.8/idle3.8
[DEBUG]: renaming build/scripts-3.8/2to3 to build/scripts-3.8/2to3-3.8
[INFO]: <- directory context /home/deviantpadam
[INFO]: Building genericndkbuild for armeabi-v7a
[INFO]: -> directory context /home/deviantpadam/.local/share/python-for-android/build/bootstrap_builds/webview/jni
[DEBUG]: -> running ndk-build V=1
[DEBUG]: Android NDK: Found platform level in /home/deviantpadam/.local/share/python-for-android/build/bootstrap_builds/webview/project.properties. Setting APP_PLATFORM to android-28.
[DEBUG]: Android NDK: WARNING:/home/deviantpadam/.local/share/python-for-android/build/bootstrap_builds/webview/jni/application/src/Android.mk:main: non-system libraries in linker flags: -lpython3.8m
[DEBUG]: Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
[DEBUG]: Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
[DEBUG]: Android NDK: current module
[DEBUG]:
/home/deviantpadam/Documents/android-ndk-r19c/build/core/
build-binary.mk:672: Android NDK: Module main depends on undefined modules: python_shared
[DEBUG]: rm -f /home/deviantpadam/.local/share/python-for-android/build/bootstrap_builds/webview/libs/armeabi-v7a/*
[DEBUG]: rm -f /home/deviantpadam/.local/share/python-for-android/build/bootstrap_builds/webview/libs/armeabi-v7a/gdbserver
[DEBUG]: rm -f /home/deviantpadam/.local/share/python-for-android/build/bootstrap_builds/webview/libs/armeabi-v7a/gdb.setup
[DEBUG]: [armeabi-v7a] Compile thumb : main <= start.c
[DEBUG]: rm -f /home/deviantpadam/.local/share/python-for-android/build/bootstrap_builds/webview/obj/local/armeabi-v7a/objs/main/start.o
[DEBUG]: /usr/bin/ccache /home/deviantpadam/Documents/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -MMD -MP -MF /home/deviantpadam/.local/share/python-for-android/build/bootstrap_builds/webview/obj/local/armeabi-v7a/objs/main/start.o.d -target armv7-none-linux-androideabi28 -fdata-sections -ffunction-sections -fstack-protector-strong -funwind-tables -no-canonical-prefixes --sysroot /home/deviantpadam/Documents/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/sysroot -g -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -fno-addrsig -fpic -mfpu=vfpv3-d16 -march=armv7-a -mthumb -Oz -DNDEBUG -mfpu=neon -I/home/deviantpadam/.local/share/python-for-android/build/bootstrap_builds/webview/jni/application/src -DANDROID -I/home/deviantpadam/.local/share/python-for-android/build/other_builds/python3-libbz2-liblzma/armeabi-v7a__ndk_target_21/python3/Include -Wa,--noexecstack -Wformat -Werror=format-security -c /home/deviantpadam/.local/share/python-for-android/build/bootstrap_builds/webview/jni/application/src/start.c -o /home/deviantpadam/.local/share/python-for-android/build/bootstrap_builds/webview/obj/local/armeabi-v7a/objs/main/start.o
[DEBUG]: [armeabi-v7a] Compile thumb : main <= pyjniusjni.c
[DEBUG]: rm -f /home/deviantpadam/.local/share/python-for-android/build/bootstrap_builds/webview/obj/local/armeabi-v7a/objs/main/pyjniusjni.o
[DEBUG]: /usr/bin/ccache /home/deviantpadam/Documents/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -MMD -MP -MF /home/deviantpadam/.local/share/python-for-android/build/bootstrap_builds/webview/obj/local/armeabi-v7a/objs/main/pyjniusjni.o.d -target armv7-none-linux-androideabi28 -fdata-sections -ffunction-sections -fstack-protector-strong -funwind-tables -no-canonical-prefixes --sysroot /home/deviantpadam/Documents/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/sysroot -g -Wno-invalid-command-line-argument -Wno-unused-command-line-argument -fno-addrsig -fpic -mfpu=vfpv3-d16 -march=armv7-a -mthumb -Oz -DNDEBUG -mfpu=neon -I/home/deviantpadam/.local/share/python-for-android/build/bootstrap_builds/webview/jni/application/src -DANDROID -I/home/deviantpadam/.local/share/python-for-android/build/other_builds/python3-libbz2-liblzma/armeabi-v7a__ndk_target_21/python3/Include -Wa,--noexecstack -Wformat -Werror=format-security -c /home/deviantpadam/.local/share/python-for-android/build/bootstrap_builds/webview/jni/application/src/pyjniusjni.c -o /home/deviantpadam/.local/share/python-for-android/build/bootstrap_builds/webview/obj/local/armeabi-v7a/objs/main/pyjniusjni.o
[DEBUG]: /home/deviantpadam/.local/share/python-for-android/build/bootstrap_builds/webview/jni/application/src/pyjniusjni.c:15:9: warning: 'LOGI' macro redefined [-Wmacro-redefined]
[DEBUG]: #define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
[DEBUG]: ^
[DEBUG]: /home/deviantpadam/.local/share/python-for-android/build/bootstrap_builds/webview/jni/application/src/pyjniusjni.c:5:9: note: previous definition is here
[DEBUG]: #define LOGI(...) do {} while (0)
[DEBUG]: ^
[DEBUG]: /home/deviantpadam/.local/share/python-for-android/build/bootstrap_builds/webview/jni/application/src/pyjniusjni.c:16:9: warning: 'LOGE' macro redefined [-Wmacro-redefined]
[DEBUG]: #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
[DEBUG]: ^
[DEBUG]: /home/deviantpadam/.local/share/python-for-android/build/bootstrap_builds/webview/jni/application/src/pyjniusjni.c:6:9: note: previous definition is here
[DEBUG]: #define LOGE(...) do {} while (0)
[DEBUG]: ^
[DEBUG]: 2 warnings generated.
[DEBUG]: [armeabi-v7a] SharedLibrary : libmain.so
[DEBUG]: /home/deviantpadam/Documents/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -Wl,-soname,libmain.so -shared /home/deviantpadam/.local/share/python-for-android/build/bootstrap_builds/webview/obj/local/armeabi-v7a/objs/main/start.o /home/deviantpadam/.local/share/python-for-android/build/bootstrap_builds/webview/obj/local/armeabi-v7a/objs/main/pyjniusjni.o -lgcc -Wl,--exclude-libs,libgcc.a -latomic -Wl,--exclude-libs,libatomic.a -target armv7-none-linux-androideabi28 -no-canonical-prefixes -L/home/deviantpadam/.local/share/python-for-android/build/other_builds/python3-libbz2-liblzma/armeabi-v7a__ndk_target_21/python3/android-build -Wl,--build-id -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,--warn-shared-textrel -Wl,--fatal-warnings -llog -lpython3.8m -lc -lm -o /home/deviantpadam/.local/share/python-for-android/build/bootstrap_builds/webview/obj/local/armeabi-v7a/libmain.so
[DEBUG]: [armeabi-v7a] Install : libmain.so => libs/armeabi-v7a/libmain.so
[DEBUG]: install -p /home/deviantpadam/.local/share/python-for-android/build/bootstrap_builds/webview/obj/local/armeabi-v7a/libmain.so /home/deviantpadam/.local/share/python-for-android/build/bootstrap_builds/webview/libs/armeabi-v7a/libmain.so
[DEBUG]: /home/deviantpadam/Documents/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip --strip-unneeded /home/deviantpadam/.local/share/python-for-android/build/bootstrap_builds/webview/libs/armeabi-v7a/libmain.so
[INFO]: <- directory context /home/deviantpadam
[INFO]: Building pytz for armeabi-v7a
[INFO]: pytz apparently isn't already in site-packages
[INFO]: Installing pytz into site-packages
[INFO]: -> directory context /home/deviantpadam/.local/share/python-for-android/build/other_builds/pytz/armeabi-v7a__ndk_target_21/pytz
[DEBUG]: -> running python3 setup.py install -O2 --root=/home/deviantpadam/.local/share/python-for-android/build/python-installs/unnamed_dist_1 --install-lib=.
[DEBUG]: Traceback (most recent call last):
[DEBUG]: File "setup.py", line 5, in <module>
[DEBUG]: import pytz
[DEBUG]: File "/home/deviantpadam/.local/share/python-for-android/build/other_builds/pytz/armeabi-v7a__ndk_target_21/pytz/pytz/__init__.py", line 12, in <module>
[DEBUG]: import datetime
[DEBUG]: File "/home/deviantpadam/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3/Lib/datetime.py", line 8, in <module>
[DEBUG]: import math as _math
[DEBUG]: ModuleNotFoundError: No module named 'math'
Exception in thread background thread for pid 24380:
Traceback (most recent call last):
File "/home/deviantpadam/anaconda3/lib/python3.7/threading.py", line 926, in _bootstrap_inner
self.run()
File "/home/deviantpadam/anaconda3/lib/python3.7/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/home/deviantpadam/anaconda3/lib/python3.7/site-packages/sh.py", line 1662, in wrap
fn(*args, **kwargs)
File "/home/deviantpadam/anaconda3/lib/python3.7/site-packages/sh.py", line 2606, in background_thread
handle_exit_code(exit_code)
File "/home/deviantpadam/anaconda3/lib/python3.7/site-packages/sh.py", line 2304, in fn
return self.command.handle_command_exit_code(exit_code)
File "/home/deviantpadam/anaconda3/lib/python3.7/site-packages/sh.py", line 877, in handle_command_exit_code
raise exc
sh.ErrorReturnCode_1:
RAN: /home/deviantpadam/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3/native-build/python3 setup.py install -O2 --root=/home/deviantpadam/.local/share/python-for-android/build/python-installs/unnamed_dist_1 --install-lib=.
STDOUT:
Traceback (most recent call last):
File "setup.py", line 5, in <module>
import pytz
File "/home/deviantpadam/.local/share/python-for-android/build/other_builds/pytz/armeabi-v7a__ndk_target_21/pytz/pytz/__init__.py", line 12, in <module>
import datetime
File "/home/deviantpadam/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3/Lib/datetime.py", line 8, in <module>
import math as _math
ModuleNotFoundError: No module named 'math'
STDERR:
Traceback (most recent call last):
File "/home/deviantpadam/anaconda3/bin/p4a", line 8, in <module>
sys.exit(main())
File "/home/deviantpadam/anaconda3/lib/python3.7/site-packages/pythonforandroid/entrypoints.py", line 18, in main
ToolchainCL()
File "/home/deviantpadam/anaconda3/lib/python3.7/site-packages/pythonforandroid/toolchain.py", line 709, in __init__
getattr(self, command)(args)
File "/home/deviantpadam/anaconda3/lib/python3.7/site-packages/pythonforandroid/toolchain.py", line 154, in wrapper_func
build_dist_from_args(ctx, dist, args)
File "/home/deviantpadam/anaconda3/lib/python3.7/site-packages/pythonforandroid/toolchain.py", line 216, in build_dist_from_args
args, "ignore_setup_py", False
File "/home/deviantpadam/anaconda3/lib/python3.7/site-packages/pythonforandroid/build.py", line 577, in build_recipes
recipe.build_arch(arch)
File "/home/deviantpadam/anaconda3/lib/python3.7/site-packages/pythonforandroid/recipe.py", line 946, in build_arch
self.install_python_package(arch)
File "/home/deviantpadam/anaconda3/lib/python3.7/site-packages/pythonforandroid/recipe.py", line 965, in install_python_package
_env=hpenv, *self.setup_extra_args)
File "/home/deviantpadam/anaconda3/lib/python3.7/site-packages/pythonforandroid/logger.py", line 167, in shprint
for line in output:
File "/home/deviantpadam/anaconda3/lib/python3.7/site-packages/sh.py", line 925, in next
self.wait()
File "/home/deviantpadam/anaconda3/lib/python3.7/site-packages/sh.py", line 849, in wait
self.handle_command_exit_code(exit_code)
File "/home/deviantpadam/anaconda3/lib/python3.7/site-packages/sh.py", line 877, in handle_command_exit_code
raise exc
sh.ErrorReturnCode_1:
RAN: /home/deviantpadam/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3/native-build/python3 setup.py install -O2 --root=/home/deviantpadam/.local/share/python-for-android/build/python-installs/unnamed_dist_1 --install-lib=.
STDOUT:
Traceback (most recent call last):
File "setup.py", line 5, in <module>
import pytz
File "/home/deviantpadam/.local/share/python-for-android/build/other_builds/pytz/armeabi-v7a__ndk_target_21/pytz/pytz/__init__.py", line 12, in <module>
import datetime
File "/home/deviantpadam/.local/share/python-for-android/build/other_builds/hostpython3/desktop/hostpython3/Lib/datetime.py", line 8, in <module>
import math as _math
ModuleNotFoundError: No module named 'math'
STDERR:
Please help me to get rid of these errors.