Skip to content

Installation

Dependencies

sudo pacman -S jdk-openjdk clang cmake ninja

Getting Android SDK using sdkmanager

~/.zshrc
export ANDROID_HOME="$HOME/Android/Sdk"
export PATH="$PATH:$HOME/Android/Sdk/cmdline-tools/latest/bin:$HOME/Android/Sdk/platform-tools"
Scroll down to "Command line tools only" in https://developer.android.com/studio. and get the download link.

mkdir -p ~/Android/Sdk/cmdline-tools
cd ~/Android/Sdk/cmdline-tools
aria2c 'https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip'
unzip commandlinetools-linux-11076708_latest.zip
mv cmdline-tools latest

Install platform-tools, build-tools

cd ~/Android/Sdk/cmdline-tools/latest/bin/sdkmanager
./sdkmanager 'platform-tools'

Install the minimum and maximum platform sdk you want to support. https://developer.android.com/tools/releases/platforms

I want to support from nougat (25) to latest (35).

cd ~/Android/Sdk/cmdline-tools/latest/bin/sdkmanager
./sdkmanager 'platforms;android-35'
./sdkmanager 'platforms;android-25'

Install latest build-tools

cd ~/Android/Sdk/cmdline-tools/latest/bin/sdkmanager
./sdkmanager 'build-tools;35.0.0'

To update all installed packages

sdkmanager --update

Install flutter

Get download link from: https://docs.flutter.dev/get-started/install/linux/desktop#download-then-install-flutter

cd ~
~ $ aria2c -x 10 -s 10 'https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.24.3-stable.tar.xz'
tar xf flutter_linux_3.24.3-stable.tar.xz
~ $ rm -rf flutter_linux_3.24.3-stable.tar.xz

Now run flutter doctor

java version

Issue:

vector@ArchLinuxVS /tmp $ flutter create test
Creating project test...
Resolving dependencies in `test`... (2.0s)
Downloading packages...
Got dependencies in `test`.
Wrote 129 files.

All done!
You can find general documentation for Flutter at: https://docs.flutter.dev/
Detailed API documentation is available at: https://api.flutter.dev/
If you prefer video documentation, consider: https://www.youtube.com/c/flutterdev

In order to run your application, type:

  $ cd test
  $ flutter run

Your application code is in test/lib/main.dart.

Newer than known valid Java version (23.0.0), gradle (8.3).
 Treating as valid configuration.
The configured version of Java detected may conflict with the Gradle version in your new Flutter app.

[RECOMMENDED] If so, to keep the default Gradle version 8.3, make
sure to download a compatible Java version
(Java 17 <= compatible Java version < Java 21).
You may configure this compatible Java version by running:
`flutter config --jdk-dir=<JDK_DIRECTORY>`
Note that this is a global configuration for Flutter.


Alternatively, to continue using your configured Java version, update the Gradle
version specified in the following file to a compatible Gradle version:
/tmp/test/android/gradle/wrapper/gradle-wrapper.properties

You may also update the Gradle version used by running
`./gradlew wrapper --gradle-version=<COMPATIBLE_GRADLE_VERSION>`.

See
https://docs.gradle.org/current/userguide/compatibility.html#java for details
on compatible Java/Gradle versions, and see
https://docs.gradle.org/current/userguide/gradle_wrapper.html#sec:upgrading_wrapper
for more details on using the Gradle Wrapper command to update the Gradle version
used.

Solution:

sudo pacman -S jdk17-openjdk
sudo archlinux-java set java-17-openjdk

Comments