Quick guide on how to set up flutter and build hello world app for android, on debian 10. Tags: flutter dart debian
Flutter has excellent documentation, which includes setup guide as well.
You need to have some basic linux tools and libraries installed, after which you can download and extract flutter SDK.
If you don't have it, you also have to install android studio. After you installed Android studio, open it and install flutter plugin.
You also need to install android sdk if you don't have it already.
I placed everything into a bin folder on my external disc. My $PATH looks like following
export PATH="$PATH:/media/frain/diskA/bin/flutter/bin"
export PATH="$PATH:/media/frain/diskA/bin/android-studio/bin"
export ANDROID_HOME="/media/frain/diskA/bin/android-sdk"
export PATH="$PATH:$ANDROID_HOME"To check if everything is ok you can invoke
flutter doctor from CLI. I just created new
flutter project from the android studio and went for it. Once
I ran the project it failed with following:
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Failed to install the following Android SDK packages as some licenses have not been accepted.
Solution to that is to run sdkmanager and
accept licenses, however, sdkmanager wasn't
included in my android sdk, so I had to find
it and install it. Updating $PATH:
export PATH="$PATH:/media/frain/diskA/bin/android-sdk/cmdline-tools/latest/bin"Freshly installed sdkmanager failed for me
with following error:
Warning: Could not create settings
java.lang.IllegalArgumentException
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.<init>(SdkManagerCliSettings.java:428)
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createSettings(SdkManagerCliSettings.java:152)
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createSettings(SdkManagerCliSettings.java:134)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:57)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
Stackoverflower
says sdkmanager expects specific directory
structure:
/android-sdk/cmdline-tools/latest/bin/
Once sdkmanager is in correct folder it can be
invoked again and license issue fixed, which enables project
to build and run.
