Flutter Installation Notes

1. Install Dependencies

Ensure you have the necessary dependencies installed:

sudo apt-get install -y curl git unzip xz-utils zip libglu1-mesa clang cmake ninja-build libgtk-3-dev
  1. Download Flutter SDK Download the latest stable version of Flutter:
tar -xf ~/Downloads/flutter_linux_3.27.4-stable.tar.xz -C ~/development/
  1. Update Path for Flutter Add Flutter to your system path by appending this line to your .bashrc (or .bash_profile):
echo 'export PATH="$HOME/development/flutter/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
  1. Check Flutter Doctor Run the following command to ensure Flutter is correctly installed:
flutter doctor
  1. Install Android SDK If you don't have Android SDK installed, you can install it:
sudo apt install android-sdk
  1. Install Command Line Tools Download and move Android command-line tools:
mv cmdline-tools/ ~/development/
mkdir -p ~/development/android-sdk/cmdline-tools
mv ~/development/cmdline-tools ~/development/android-sdk/cmdline-tools/latest
  1. Set ANDROID_HOME Path Add the following to .bashrc for the Android SDK:
echo 'export ANDROID_HOME=~/development/android-sdk' >> ~/.bashrc
source ~/.bashrc
  1. Install Required SDK Packages Run sdkmanager to install the necessary Android SDK components:
sdkmanager --install "cmdline-tools;latest" "platform-tools" "platforms;android-34" "build-tools;34.0.0"
  1. Accept Android Licenses To accept the Android SDK licenses, run:
flutter doctor --android-licenses
  1. Verify Setup Ensure everything is set up correctly by running:
flutter doctor

By following these steps, you'll have Flutter and Android SDK correctly installed and configured on your system.

Errors ==>

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: com/android/sdklib/tool/sdkmanager/SdkManagerCli has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:621)
user:~/Desktop$ flutter doctor --android-licenses
Android sdkmanager not found. Update to the latest Android SDK and ensure that the cmdline-tools are installed to resolve this.

  1. Check if you have an SSH key Run:
ls -al ~/.ssh

If you see files like id_rsa and id_rsa.pub (or id_ed25519 and id_ed25519.pub), you have an SSH key. If not, you need to generate one.

  1. Generate an SSH Key (if missing) If you don’t have a key, generate one using:
ssh-keygen -t ed25519 -C "your-email@example.com"

Press Enter to accept the default location (~/.ssh/id_ed25519), then add a passphrase or leave it empty.

  1. Add SSH Key to GitHub Copy the public key:
cat ~/.ssh/id_ed25519.pub

Go to GitHub → Settings → SSH and GPG keys → New SSH Key, paste the copied key, and save.

  1. Add the SSH Key to SSH Agent Run:
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
  1. Test SSH Connection Check if SSH works:
ssh -T git@github.com

If successful, it should say:

Hi user! You've successfully authenticated, but GitHub does not provide shell access.

  1. Retry Pushing the Code
git push --set-upstream origin master

Written by A.M. Rinas