how to build android apk
MominIqbal-1234 opened this issue · comments
https://github.com/r0x0r/pywebview/tree/master/examples/todos
i convert this code into the apk
I run all steps in google cloab
tell me how to build apk
There is a brief freezing guide here https://pywebview.flowrl.com/guide/freezing.html#android
Ultimately you need to get familiar with Buildozer. Start here https://buildozer.readthedocs.io/en/latest/quickstart.html
@r0x0r ,
I've executed "pip install --upgrade pywebview", and got the "android.add_jars" absolute path and filled it into "buildozer.spec",
But when I run "buildozer -v android release" in ~/pywebview/examples/todos,
I happen this error in ~/pywebview/examples/todos/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/libffi/armeabi-v7a__ndk_target_21/libffi/config.log:
configure:4544: ~/.buildozer/android/platform/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target armv7a-linux-androideabi21 -fomit-frame-pointer -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mthumb -fPIC -V >&5
clang-14: error: argument to '-V' is missing (expected 1 value)
It seems that the libffi require GCC, but the NDK has get rid of GCC since r18(kivy/buildozer#1281)
How to work around this error?
Thanks.
Sorry, I cannot help with buildozer issues.
buildozer is finicky when it comes to getting environment right. Good luck!
Sad, there's another error:
configure:4575: checking whether the C compiler works
configure:4597: ~/.buildozer/android/platform/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -target aarch64-linux-android21 -fomit-frame-pointer -march=armv8-a -fPIC -target aarch64-linux-android21 -fomit-frame-pointer -march=armv8-a -fPIC -DANDROID -I~/.buildozer/android/platform/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include -I~/pywebview/examples/todos/.buildozer/android/platform/build-arm64-v8a/build/python-installs/pywebview todos/arm64-v8a/include/python3.1 -L~/pywebview/examples/todos/.buildozer/android/platform/build-arm64-v8a/build/libs_collections/pywebview todos/arm64-v8a conftest.c >&5
clang-14: error: no such file or directory: 'todos/arm64-v8a/include/python3.1'
clang-14: error: no such file or directory: 'todos/arm64-v8a'
It seems the "todos/buildozer.spec" file needs some path configuration.
Here is the deploy/build script that is working for me
export ANDROIDSDK="/Users/roman/Library/Android/sdk"
export ANDROIDNDK="/Users/roman/Library/Android/sdk/ndk/25.0.8775105"
export ANDROIDAPI="30" # Target API version of your application
export NDKAPI="21" # Minimum supported API version of your application
export JAVA_HOME=/usr/local/opt/openjdk@17/
export ANDROID_SERIAL=emulator-5554
buildozer android debug deploy runad
buildozer Run Linux so i use the google cloab to make apk file first time you wait minimum 30 mint first kivymd apk build
i not test to pywebview not free time but i try this saturday or sunday try for pywebview
https://colab.research.google.com/drive/1kmIVFtTyXQF-PbSONC1uR7pnoMSh-aIk?usp=sharing
Finally, I figured out what's wrong:
1.fixed the error "clang-14: error: no such file or directory: 'todos/arm64-v8a'", the buildozer package.name requirement is one word with only ASCII characters and/or numbers. It should not contain any special characters
2.fix the error "if exclude_dir[-1] != '/':IndexError: string index out of range" while "buildozer -v android release"
Now the command "buildozer -v android debug deploy run" works like a charm.
I've submitted a pull request: #1368