Update android_build.yml #11
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Android APK | |
on: | |
push: | |
branches: [testing] | |
pull_request: | |
branches: [testing] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
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 system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
wget \ | |
unzip \ | |
python3-pip \ | |
build-essential \ | |
git \ | |
python3 \ | |
python3-dev \ | |
ffmpeg \ | |
libsdl2-dev \ | |
libsdl2-image-dev \ | |
libsdl2-mixer-dev \ | |
libsdl2-ttf-dev \ | |
libportmidi-dev \ | |
libswscale-dev \ | |
libavformat-dev \ | |
libavcodec-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 | |
- name: Accept all SDK licenses | |
run: | | |
yes | sdkmanager --licenses | |
yes | sdkmanager "platform-tools" "platforms;android-33" "build-tools;33.0.2" "cmdline-tools;latest" | |
- name: Manually Install AIDL | |
run: | | |
# Download Android SDK Command Line Tools | |
wget https://dl.google.com/android/repository/commandlinetools-linux-10406996_latest.zip | |
unzip commandlinetools-linux-10406996_latest.zip -d $ANDROID_HOME/cmdline-tools | |
mv $ANDROID_HOME/cmdline-tools/cmdline-tools $ANDROID_HOME/cmdline-tools/latest | |
# Update PATH to include command-line tools | |
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin | |
# Install additional SDK components | |
yes | sdkmanager "build-tools;33.0.2" "platforms;android-33" | |
# Verify AIDL installation | |
$ANDROID_HOME/build-tools/33.0.2/aidl --version || echo "AIDL installation failed" | |
- name: Verify Android SDK Installation | |
run: | | |
echo "ANDROID_HOME: $ANDROID_HOME" | |
ls -l $ANDROID_HOME | |
ls -l $ANDROID_HOME/build-tools | |
which aidl || echo "AIDL not found in PATH" | |
$ANDROID_HOME/build-tools/33.0.2/aidl --version || echo "AIDL version check failed" | |
- name: Prepare Buildozer environment | |
run: | | |
export ANDROID_HOME=$HOME/android-sdk | |
pip install --upgrade buildozer | |
pip install --upgrade cython | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade cython | |
- name: Build APK | |
env: | |
ANDROID_HOME: ${{ env.ANDROID_SDK_ROOT }} | |
run: | | |
cd projects/android | |
# Set build tools and platform tools 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/.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" |