Build Flutter Apk On Android and iOS

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Download and install termux from f-droid

https://f-droid.org/repo/com.termux_118.apk
Now install Ubuntu in termux using proof given here
https://wiki.termux.com/wiki/PRoot
Or run following commands

pkg install proot


pkg install proot-distro
proot-distro install ubuntu
proot-distro login ubuntu

Now you are inside ubuntu, run following commands


apt update
apt install android-sdk wget zip unzip micro git xz-utils libglu1-mesa clang cmake ninja-build
pkg-config libgtk-3-dev liblzma-dev sudo

adduser <your user name here>


Like => adduser anil

micro /etc/sudoers
On line number 45 add
anil ALL=(ALL:ALL) ALL
Ctrl+s and Ctrl+q to save and exit

su - anil
sudo apt update

Now download flutter and add it's path


Run=>
git clone -b master https://github.com/flutter/flutter.git
./flutter/bin/flutter --version

Add flutter to path


micro .bashrc
Add following line after end of .bashrc file
export PATH="$PATH:/home/anil/flutter/bin"

To test flutter running on your system


Run=>
flutter doctor
Or
flutter –version
flutter create myapp
cd myapp
flutter run -d web-server --web-hostname=127.0.0.1 --web-port=8000
Now open your desired browser/chrome/kiwi+dart debug extension
Goto following website
http://127.0.0.1:8000
If you can see flutter demo home page than you are on right track

mkdir android_sdk
cd android_sdk
Now download cmdline-tools from android.com
wget https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip
unzip commandlinetools-linux-8512546_latest.zip
cd cmdline-tools
mkdir latest
mv NOTICE.txt latest
mv lib latest
mv bin latest
mv source.properties latest
cd latest/bin
./sdkmanager --install "build-tools;33.0.0" "platforms;android-33"
Accept license by pressing y
Now download android build tools for arm64 device =>
cd
wget
https://github.com/lzhiyong/android-sdk-tools/releases/download/33.0.3/android-sdk-tools-static-
aarch64.zip

unzip sdk-tools-static-aarch64.zip
cd sdk-tools-aarch64/build-tools
cp * /home/anil/android-sdk/build-tools/33.0.0
cd
cd android-sdk
cp licenses /usr/lib/android-sdk
cp platforms /usr/lib/android-sdk
cd build-tools
cp 33.0.0 /usr/lib/android-sdk/build-tools
cd
cd myapp/android
gradle
gradle assembleDebug
It will show aapt2-something-linux.jar error now run=>
find . -name "aapt2-*-linux.jar"
Copy this output somewhere
cd
cd sdk-tools-aarch64/build-tools
cp aapt2 paste the path you copied now delete last name of file just paste the path
Now goto path you copied & run =>
jar -uvf aapt2-7.2.0-7984345-linux.jar aapt2
cd
cd myapp/android
gradle clean
gradle assembleDebug
It will show build success
cd ..
cd /home/anil/myapp/build/app/outputs/apk/debug
python3 -m http.server
Goto http://0.0.0.0:8000/
Download app-debug.apk and install t7he app.

To build apk in Release Mode first you need to make a directory


cd ~
cd flutter/bin/cache/artifacts/engine/android-arm64-release/
mkdir linux-arm64
cd ~/flutter/bin/cache/artifacts/engine/linux-arm64-release/
cp gen_snapshot ~/flutter/bin/cache/artifacts/engine/android-arm64-release/linux-arm64/
cd
cd myapp
flutter build apk --target-platform=android-arm64

cd
wget -O- https://aka.ms/install-vscode-server/setup.sh | sh
code-server serve-local

goto something like this shown in your terminal in browser


http://localhost:8000/?tkn=f4c5b343-12a5-41ef-9243-a355a3225c0c

Hurray 🤳 your flutter build setup is ready

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy