sudo pacman -S flutter dart kotlin android-sdk android-sdk-platform-tools android-sdk-build-tools \
android-platform android-sdk-cmdline-tools-latest jdk17-openjdk
Note: The required JDK must be higher than 11.
Put them in .bashrc, .zshrc or any other shell init script:
export ANDROID_SDK_ROOT=/opt/android-sdk
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/tools/bin/
export PATH=$PATH:$ANDROID_ROOT/emulator
export PATH=$PATH:$ANDROID_SDK_ROOT/tools/
Restart your shell session. Close terminal and open again.
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk
Note: The JDK version could be different at the time you use this info.
export CHROME_EXECUTABLE=/opt/google/chrome/chrome
Modify /path/to/project/android/gradle.properties
org.gradle.jvmargs=--DsocksProxyHost=127.0.0.1 -DsocksProxyPort=9050
Then, start the tor service or any socks proxy that you prefer.
cd /path/to/project/
flutter -vv build apk
This will download all required dependencies the first time. It will take a long time, specially on slow Internet connection.
Create init.gradle at ~/.gradle and put in it:
startParameter.offline=false
Then, you can build the project without depending on the Internet.