Basically I'm making an app using Pythons kivy and kivymd frame work.In my app I'm using instaloader module.Using Github Action (CI) I'm converting my app to apk. After converting,when i try to open my apk it crashes immediately.
Here's my Debug Log
I/python ( 8065): Traceback (most recent call last):
I/python ( 8065): File "/github/workspace/.buildozer/android/app/main.py", line 9, in <module>
I/python ( 8065): File "/github/workspace/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/stalkgram/arm64-v8a/instaloader/__init__.py", line 16, in <module>
I/python ( 8065): File "/github/workspace/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/stalkgram/arm64-v8a/instaloader/instaloader.py", line 24, in <module>
I/python ( 8065): File "/github/workspace/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/stalkgram/arm64-v8a/instaloader/nodeiterator.py", line 7, in <module>
I/python ( 8065): File "<frozen zipimport>", line 259, in load_module
I/python ( 8065): File "/github/workspace/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/python3/arm64-v8a__ndk_target_21/python3/Lib/lzma.py", line 27, in <module>
I/python ( 8065): ModuleNotFoundError: No module named '_lzma'
I/python ( 8065): Python for android ended.
Here's my build.yml
(CI)
name: CI
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get Date
id: get-date
run: |
echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
shell: bash
- name: Cache Buildozer global directory
uses: actions/cache@v2
with:
path: .buildozer_global
key: buildozer-global-${{ hashFiles('buildozer.spec') }}
- uses: actions/cache@v2
with:
path: .buildozer
key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ hashFiles('buildozer.spec') }}
- name: Install AIDL
run: |
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install libstdc++6
sudo apt-get install aidl
sudo apt-get install -y liblzma-dev
pip3 install backports.lzma
pip3 install backports.weakref
- name: Build with Buildozer
uses: ArtemSBulgakov/buildozer-action@v1
id: buildozer
with:
command: buildozer android debug
buildozer_version: master
- name: Modify lzma.py
run: |
cd .buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/python3/arm64-v8a__ndk_target_21/python3/Lib
sudo apt-get install -y liblzma-dev
pip3 install backports.lzma
pip3 install backports.weakref
cd /home/runner/work/Stalkgram/Stalkgram
ls
sudo cp lzma.py .buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/other_builds/python3/arm64-v8a__ndk_target_21/python3/Lib
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: package
path: ${{ steps.buildozer.outputs.filename }}
Here's my buildozer.spec
requirements.
requirements = python3==3.9.10,hostpython3==3.9.10,kivy==2.1.0,pillow,kivymd==1.1.1,certifi,android,instaloader==4.10.1,plyer==2.1.0
Then i solved this issue following this
Before modification
from _lzma import *
from _lzma import _encode_filter_properties, _decode_filter_properties
After modification
try:
from _lzma import *
from _lzma import _encode_filter_properties, _decode_filter_properties
except ImportError:
from backports.lzma import *
from backports.lzma import _encode_filter_properties, _decode_filter_properties
And it works.But now getting another error and that is
I/python ( 7917): File "/github/workspace/.buildozer/android/app/lzma.py", line 31, in <module>
I/python ( 7917): ModuleNotFoundError: No module named 'backports'
I/python ( 7917): Python for android ended.