Skip to content

Commit

Permalink
Update android_build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
kqlio67 authored Nov 7, 2024
1 parent b968abc commit a50b3fc
Showing 1 changed file with 59 additions and 19 deletions.
78 changes: 59 additions & 19 deletions .github/workflows/android_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,23 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9.20'

- name: Install dependencies
- name: Install system dependencies
run: |
python -m pip install --upgrade pip
pip install buildozer cython
pip install kivy==2.3.0 aiohttp==3.9.3 requests==2.31.0 beautifulsoup4==4.12.3 Unidecode==1.3.8 pywebview pillow platformdirs plyer proxy_tools bottle typing_extensions cryptography brotli
sudo apt-get update
sudo apt-get install -y \
wget \
unzip \
python3-pip \
build-essential \
git \
Expand All @@ -39,37 +44,72 @@ jobs:
libswscale-dev \
libavformat-dev \
libavcodec-dev \
zlib1g-dev
zlib1g-dev \
autoconf \
libtool \
pkg-config
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install buildozer cython
pip install kivy==2.3.0 aiohttp==3.9.3 requests==2.31.0 \
beautifulsoup4==4.12.3 Unidecode==1.3.8 pywebview \
pillow platformdirs plyer proxy_tools bottle \
typing_extensions cryptography brotli
- name: Setup Android SDK
uses: android-actions/setup-android@v2
with:
cmdline-tools-version: 9.0

- name: Accept Android SDK licenses
run: yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses
- name: Install Android SDK components
run: |
sdkmanager "platform-tools" "platforms;android-33" "build-tools;33.0.2"
sdkmanager "cmdline-tools;latest"
yes | sdkmanager --licenses
- name: Install Android SDK Build-Tools
- name: Verify Android SDK Installation
run: |
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "build-tools;33.0.0"
echo "ANDROID_BUILD_TOOLS_PATH=$ANDROID_HOME/build-tools/33.0.0" >> $GITHUB_ENV
echo "ANDROID_HOME: $ANDROID_HOME"
ls -l $ANDROID_HOME
ls -l $ANDROID_HOME/build-tools
which aidl || echo "AIDL not found"
- name: Set up Buildozer
- name: Prepare Buildozer environment
run: |
buildozer init
sed -i 's/^android.accept_sdk_license =.*/android.accept_sdk_license = True/' buildozer.spec
sed -i 's/^android.sdk_path =.*/android.sdk_path = \/usr\/local\/lib\/android\/sdk/' buildozer.spec
sed -i 's/^android.ndk_path =.*/android.ndk_path = \/usr\/local\/lib\/android\/ndk/' buildozer.spec
sed -i 's/^android.build_tools =.*/android.build_tools = 33.0.0/' buildozer.spec
pip install --upgrade buildozer
pip install --upgrade cython
# Ensure Cython is installed before building
python -m pip install --upgrade pip
python -m pip install --upgrade cython
- name: Build APK
env:
ANDROID_HOME: ${{ env.ANDROID_SDK_ROOT }}
ANDROID_BUILD_TOOLS_PATH: ${{ env.ANDROID_BUILD_TOOLS_PATH }}
run: |
cd projects/android
buildozer android debug
# Ensure build tools are in PATH
export PATH=$PATH:$ANDROID_HOME/build-tools/33.0.2
export PATH=$PATH:$ANDROID_HOME/platform-tools
# Debug information
echo "Current directory: $(pwd)"
echo "Build tools path: $ANDROID_HOME/build-tools/33.0.2"
# Attempt to build with verbose output
buildozer android debug deploy run verbose
- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: app-debug
path: projects/android/bin/*.apk
path: |
projects/android/.buildozer/android/platform/python-for-android/dist/default/bin/*.apk
projects/android/bin/*.apk
- name: Debug Build Failure
if: failure()
run: |
echo "Build failed. Checking build logs..."
cat projects/android/.buildozer/logs/build.log || echo "No build log found"

0 comments on commit a50b3fc

Please sign in to comment.