Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to build android apk #1352

Open
MominIqbal-1234 opened this issue Apr 4, 2024 · 8 comments
Open

how to build android apk #1352

MominIqbal-1234 opened this issue Apr 4, 2024 · 8 comments
Labels

Comments

@MominIqbal-1234
Copy link

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

@r0x0r
Copy link
Owner

r0x0r commented Apr 7, 2024

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

@diyism
Copy link
Contributor

diyism commented Apr 19, 2024

@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.

@r0x0r
Copy link
Owner

r0x0r commented Apr 19, 2024

Sorry, I cannot help with buildozer issues.

buildozer is finicky when it comes to getting environment right. Good luck!

@diyism
Copy link
Contributor

diyism commented Apr 19, 2024

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.

@r0x0r
Copy link
Owner

r0x0r commented Apr 20, 2024

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 run

@MominIqbal-1234
Copy link
Author

MominIqbal-1234 commented Apr 21, 2024

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

@diyism
Copy link
Contributor

diyism commented Apr 21, 2024

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

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants