forked from xtekky/gpt4free
-
Notifications
You must be signed in to change notification settings - Fork 1
130 lines (109 loc) · 3.95 KB
/
android_build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
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"