This guide will help you build an APK for your Flet project using GitHub Actions and Termux/Linux terminal.
- GitHub account
- Termux or a Linux terminal
- Basic knowledge of GitHub Actions and terminal commands
Create a new repository on GitHub and add a file named build.yml
in the .github/workflows
directory.
Paste the following code into the build.yml
file:
name: Install and Run tmate
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install tmate
run: |
sudo apt-get update
sudo apt-get install -y tmate
- name: Run tmate
uses: mxschmitt/action-tmate@v3
with:
tmate-server-host: ssh.tmate.io
tmate-server-port: 22
tmate-server-rsa-fingerprint: SHA256:Hthk2T/M/Ivqfk1YYUn5ijC2Att3+UPzD7Rn72P5VWs
tmate-server-ed25519-fingerprint: SHA256:jfttvoypkHiQYUqUCwKeqd9d1fJj/ZiQlFOHVl6E9sI
timeout-minutes: 120
- Save the
build.yml
file. - Navigate to the 'Actions' tab in your GitHub repository and run the action.
Once the action has run, it will generate an SSH key. Copy this key, which will look something like:
ssh dHYFJJVCFTJJ.tmate.io
Paste the copied SSH key into your Termux or Linux terminal to connect to the SSH server.
Run the following commands on the SSH server:
wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.22.0-stable.tar.xz
tar xJf flutter_linux_3.22.0-stable.tar.xz
echo "export PATH=\$PATH:\$HOME/path/to/flutter/bin" >> ~/.profile
source ~/.profile
sudo apt install android-sdk sdkmanager
sdkmanager --licenses
sudo -E sdkmanager "ndk;23.1.7779620"
pip install flet --upgrade
Note: Replace path/to/flutter/bin
with the actual path where you extracted Flutter.
-
Clone the repository:
git clone https://github.com/mahmoodsaed/FletToAPK.git
-
Navigate to the
FletToAPK
directory:cd FletToAPK
-
Run the install script:
bash install.sh
flet create Project_name
cd path/to/project/Project_name
flet build apk
cd build/apk
curl -F file=@path_to_apk_file https://file.io
This will generate a download link. Copy this link to download your APK.
By following these steps, you'll be able to build and download your Flet APK. Have fun!