error installing flutter in ubuntu 18.04: "Android license status unknown" - android

I followed all the steps to install flutter in the web
When finished, I tried the command in the terminal: $ flutter doctor -v
the result was all good except one:
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /home/agung/Android/Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• Java binary at: /home/agung/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
✗ Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.
I tried some tips, the last tips I used was: installing java with this:
sudo apt-get install openjdk-11-jdk
and change the java with this:
sudo update-alternatives --config java
and I tried any combinations, but nothing works. (I have followed any tips in stakeoverflow but nothing works)
How to fix this? To make result of 'flutter doctor -v' good?

Try following the install instructions in the official flutter site. The specific part on android licenses is here: https://flutter.dev/docs/get-started/install/linux#android-setup
In short: install Android Studio, install the sdks through Android Studio and accept the licenses there. The link goes into details as to why. Afterwards flutter doctor should return just peachy
Do notice that these are the instructions for Linux. Follow this link to pick your own OS and read the appropriate guide: https://flutter.dev/docs/get-started/install

In console run:
flutter doctor --android-licenses and answer y to all

Related

UnsupportedClassVersionError while 'flutter doctor --android-licenses' MacOS

System Settings:
MacOS Ventura
Android Studio Electric Eel
I am installing Flutter on my Intel Mac.
After Running flutter doctor
The outcome is this:
[✓] Flutter (Channel stable, 3.7.0, on macOS 13.2 22D49 darwin-x64, locale
en-MX)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for
more details.
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.1)
[✓] VS Code (version 1.74.3)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
and after running flutter doctor --android-licenses the outcome is this:
Exception in thread "main" java.lang.UnsupportedClassVersionError:
com/android/prefs/AndroidLocationsProvider
has been compiled by a more recent version of the Java Runtime (class file version 55.0),
this version of the Java Runtime only recognizes class file versions up to 52.0
I installed Java for Mac from this link on January 2023 from Here
Has someone encountered the same error? How did you fix it?
I will try to give a more detailed solution:
Install the latest version of the Java SDK from this link
Pick Java 19 and the x64 DMG Installer (this worked for me)
Follow the installation instructions.
[optional] If necessary, set your JAVA_HOME path following these instructions (mac)
Test the installation by running flutter doctor --android-licenses
Additionally from what Tomas Ward said about installing the lastest SDK, for windows I found this for adding the JAVA_HOME to the path. Hope it helps.
For Windows
Download and Install latest JDK from [Java SE Development Kit 19.0.2][1]
Set a system variable as
Variable Name: JAVA_HOME
Variable Value: C:\Program Files\Java\jdk-19
Add a path variable name as %JAVA_HOME%\bin
Now run flutter doctor
Hope, it will solve.
[1]: https://www.oracle.com/java/technologies/downloads/#jdk19-windows
While installing the JDK by Oracle download works, best way to make sure that you have the correct version on MacOS is to install JDK using Homebrew (If you don't have Homebrew, Installation instructions: https://docs.brew.sh/Installation). Also, keeping it up-to-date is a lot easier this way.
brew install openjdk
If you have other OpenJDK versions installed, you may need to link this correct one:
brew link --force openjdk#19
To make it the default for your shell, add the following lines to ~/.zshrc:
export JAVA_HOME="/opt/homebrew/opt/openjdk"
export PATH="$JAVA_HOME/bin:$PATH"
And then:
source ~/.zshrc
You only need to do this once.
Then rerun: flutter doctor --android-licenses
Found the solution.
I needed to update the JDK from here.
I have uninstalled. JRE Java runtime environment and it works.
Yeah #Tomas Ward solution is worked For me. But Let me add some more details For the Windows users.
As #Tomas says We need to download Java SE Development Kit
19.0.2 First of all Click On This Link To Download Java SE Development Kit 19.0.2.
Then Download x64 Installer OR x64 MSI Installer Then
Install Java SE Development Kit In Your System.
Now You need to Set OR Update This New Java SE Development Kit Path into Your
JAVA_HOME Path.
And As You Set/Update JAVA_HOME Path Your Error will resolved.

How to fix Gradle task assembleDebug failed with exit code -1?

So today I freshly installed android studio for flutter. I followed every step given on the flutter website. Yet I came across multiple issues at different point of time.
List Of Events:
1. Tried to run the app, the Gradle task assembleDebug Kept On loading and i found out i need to install Android API 28, That being done now came the
C:\Users\DELL\AndroidStudioProjects\example>flutter run
Launching lib\main.dart on ASUS X00TD in debug mode...
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 38.3s
Gradle task assembleDebug failed with exit code -1
After wandering of the internet, One solution prominently given was to install the 'Android SDK Tools (Obsolete). turns out i have already installed it.
Click Here For The Snapshot
Now running upon flutter doctor it shows
C:\Users\DELL>flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.17763.914], locale en-US)
• Flutter version 1.12.13+hotfix.5 at C:\flutter\flutter
• Framework revision 27321ebbad (6 months ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\Users\DELL\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
X Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed
instructions.
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 46.0.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.45.1)
• VS Code at C:\Users\DELL\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.11.0
again wandering on the internet i found out that this error might have to deal with it. so again the same solution came up : install the 'Android SDK Tools (Obsolete).'
running upon flutter doctor --android-licenses
it showed that sdkmanager is missing. so i manually downloaded the commandtoollines from the android studio website(this one had 'sdkmanager.bat' which was missing in the orginal one;, and pasted it to the required folder. Now I am getting a new error yay!!!!!.
C:\Users\DELL>flutter doctor --android-licenses
A newer version of the Android SDK is required. To update, run:
C:\Users\DELL\AppData\Local\Android\sdk\tools\bin\sdkmanager --update
So i would highly appreciate someone if anyone could help me out.
In Android Studio, there is a tab at the bottom of the screen that says Terminal,
This is where this tab is located at the bottom of the screen
Copy and paste the following statement into the terminal and run it
C:\Users\DELL\AppData\Local\Android\sdk\tools\bin\sdkmanager --update
Hopefully after the update is done, things should go alright. Otherwise, you might need to run some other statements and check what else is missing. Installing Android studio may be a bit tedious because it depends on a lot of factors to run properly.

How to solve: Android license status unknown and also Android sdkmanager tool not found?

Tried everything i had found(github issues, SO questions) . Also tried to re-install Android SDK(29) from Android Studio.
flutter doctor
C:\Users\Zheny>flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18363.693], locale ru-RU)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
X Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.
[√] Android Studio (version 3.6)
[!] VS Code (version 1.42.1)
X Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[!] Connected device
! No devices available
! Doctor found issues in 3 categories.
flutter doctor --android-licenses
Android sdkmanager tool not found
(C:\Users\Zheny\AppData\Local\Android\Sdk\tools\bin\sdkmanager).
Try re-installing or updating your Android SDK,
visit https://flutter.dev/setup/#android-setup for detailed instructions.
flutter doctor -v
C:\Users\Zheny>flutter doctor -v
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18363.693], locale ru-RU)
• Flutter version 1.12.13+hotfix.8 at C:\Flutter SDK\flutter
• Framework revision 0b8abb4724 (2 weeks ago), 2020-02-11 11:44:36 -0800
• Engine revision e1e6ced81d
• Dart version 2.7.0
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at C:\Users\Zheny\AppData\Local\Android\Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.3
• ANDROID_HOME = C:\Users\Zheny\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
X Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.
[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 44.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[!] VS Code (version 1.42.1)
• VS Code at C:\Users\Zheny\AppData\Local\Programs\Microsoft VS Code
X Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[!] Connected device
! No devices available
! Doctor found issues in 3 categories.
Screens of my PATH's and folders
How can i sovle this problem?
Follow these steps
Open the Android Studio SDK Manager
In the Android SDK tab, uncheck Hide Obsolete Packages
Check Android SDK Tools (Obsolete)
Source:
https://flutter.dev/docs/get-started/install/macos#install-android-studio
download https://developer.android.com/studio#command-tools and extract in
C:\Users\Zheny\AppData\Local\Android\Sdk folder
and set path like this
C:\Users\Zheny\AppData\Local\Android\Sdk\tools\bin
restart power-shell or command prompt
and execute
flutter doctor --android-licenses
follow these steps:
open SDK Manager
go to SDK tools
Delete the "Android SDK Tools" from SDK Manager
first deselect the "Hide Obsolete Packages" and then select "Android SDK Tools (Obsolete)", install it.
run flutter doctor --android-licenses and select y for the prompts.
run flutter doctor and everything will be fine!!!!
Depending on your install paths,
your System Variables should have:
ANDROID_HOME C:\Users\\AppData\Local\Android\sdk
JAVA_HOME C:\Program Files\Android\Android Studio\jre\
your Path should have:
C:\Program Files\Android\Android Studio\jre\bin
C:\src\flutter\bin
Then run "flutter doctor" from command prompt (without the quotation marks).
If same error occur, open Android Studio, go to Settings and navigate to "Appearance & Behavior > System Settings > Android SDK", then at the top of the window and to the right of Android SDK Location, click on Edit, and from the window that opens, update your current SDK Manager and install the latest API if not already installed; once everything is updated or installed in this windows, close the Android Studio and close the command prompt.
Open a new command prompt and run "flutter doctor" again (without the quotation marks). Follow the software instructions to accept all Android Licenses.
Follow these steps
1. Open the Android Studio SDK Manager
2. Android SDK Command-line Tools (latest)
Install this one.

How to fix "Android license status unknown" in flutter

my flutter doctor -v result:
[√] Flutter (Channel stable, v1.0.0, on Microsoft Windows [Version 10.0.17134.472], locale fa-IR)
• Flutter version 1.0.0 at C:\Android\flutter
• Framework revision 5391447fae (6 weeks ago), 2018-11-29 19:41:26 -0800
• Engine revision 7375a0f414
• Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)
[!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at c:\Android\android-sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 27.0.3
• ANDROID_HOME = C:\Android\android-sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
X Android license status unknown.
[√] Android Studio (version 3.1)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 29.0.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
[√] Connected device (1 available)
• HUAWEI CUN U29 • CCMBBCB6C0153603 • android-arm • Android 5.1 (API 22)
and when run:
flutter doctor --android-licenses
get me this result:
A newer version of the Android SDK is required. To update, run:
c:\Android\android-sdk\tools\bin\sdkmanager --update
and when update sdkmanager show this error to me:
Exception in thread "main" java.lang.NoSuchFieldError: FN_AAPT2
at com.android.sdklib.BuildToolInfo.<init>(BuildToolInfo.java:362)
How can i solve this challenge?
I solved this problem by installing the command line tool.
And then rerun
flutter doctor --android-licenses
I have followed these steps. It worked for me.
went to Environment variables and added ANDROID_HOME with a variable value of:
C:\Users\%username%\AppData\Local\Android\Sdk
then my JAVA_HOME with this variable value:
C:\Program Files\Android\Android Studio\jre
then my Path with this variable value:
C:\Users\%username%\flutter\bin
then I ran the following command
flutter doctor
Got the output of Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.2.3, on Microsoft Windows [Version 10.0.16299.309],
locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK 27.0.3)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --
android-licenses
[√] Android Studio (version 3.1)
[√] Connected devices (1 available)
! Doctor found issues in 1 category.
Then I ran
flutter doctor --android-licenses
and accepted all Terms & Conditions with (y)
Install Android SDK Command-line Tools on android studio using the SDK manager
Run flutter doctor --android-licenses
Now this problem with the license has got to do with the java development kit(JDK) version.
For some reasons if you are not using JDK 8 or below, you will unfortunately get license issues.So basically uninstall current version and install JDK 8 or below. Check link below and follow the conversation carefully.
https://github.com/flutter/flutter/issues/16025
I solved pb (jdk11 on Win10 at beginning) following Nitesh steps (thanks) but with some change due to win10 strange behavior ( i know...).
To objectify, create two environment'variables with win10 wizards :
I strike :
TEST1 C:\Users\%username%\XXX
TEST2 %USERPROFILE%\YYY
Appear correct in wizard:
TEST1 C:\Users\pirla\XXX
TEST2 C:\Users\pirla\YYY
But in a dos command window, this comes to SYSTEM in first case despite correct username :
C:\Users\pirla>echo %username%
pirla
C:\Users\pirla>set TEST
TEST1=C:\Users\SYSTEM\XXX
TEST2=C:\Users\pirla\YYYY
So replace
C:\Users\%username%\
by
%USERPROFILE%\
and averything is ok.
( by the way, if you have also an JRE_HOME , change it too )
HTH
There is an SDK Manager Icon in the top right of Android Studio between the AVD manager icon and the magnifying glass. Click it.
You get a modal that shows you are in System Settings -> Android SDK n the left menu. In the middle area there is an SDK Tools tab so click it.
Check off the box that says "Android SDK Command-line Tools (latest)" and click Apply. It will install it (about 105M). Now run flutter doctor --android-licenses and say yes to everything. The error should be gone.
Use flutter_console instead of CMD
flutter doctor --android-licenses
This worked for me:
open Android Studio's SDK Manager
go to the Android SDK tab
under SDK Tools, uncheck Hide Obsolete Packages
install Android SDK Tools (Obsolete)
SOLUTION: None of the above works when setting up a Windows 10 Flutter 1.17.1 environment for mobile development. The quickest and easiest solve is to download android-studio-ide-193.6514223-windows (Android 4.0) from https://developer.android.com/studio/archive.
Download Android 4.0
Install Command
Line Tools in SDK Settings
Reboot Open Command Prompt
flutter doctor -v
You must install Android SDK Command-line Tool(Latest).
Go to SDK Manager in android studio, in tab SDK Tools, check in Android SDK Command-line Tool(Latest) and then click "apply".
On Windows:
open cmd and run:
android update sdk
After that run flutter doctor again
in terminal :
flutter update
flutter doctor --android-licenses
accept all terms by y
Uninstall Android Studio or the Android SDK. Reinstall it.

Flutter not detecting Android SDK

I've been trying to get flutter to detect the Android SDK.
flutter doctor
returns
PS I:\Projects\Flutter\fluttertest\flutterproject> flutter doctor -v
[√] Flutter (Channel beta, v0.1.5, on Microsoft Windows [Version
10.0.16299.248], locale en-US)
• Flutter version 0.1.5 at I:\Source\flutter
• Framework revision 3ea4d06340 (7 days ago), 2018-02-22 11:12:39 -0800
• Engine revision ead227f118
• Dart version 2.0.0-dev.28.0.flutter-0b4f01f759
[!] Android toolchain - develop for Android devices
• Android SDK at C:\NVPACK\android-sdk-windows
• Android NDK location not configured (optional; useful for native profiling support)
• ANDROID_HOME = C:\NVPACK\android-sdk-windows
X Android SDK is missing command line tools; download from "link to google"
• Try re-installing or updating your Android SDK,
visit https://flutter.io/setup/#android-setup for detailed instructions.
[√] Android Studio (version 3.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)
[√] VS Code (version 1.20.1)
• VS Code at C:\Program Files\Microsoft VS Code
• Dart Code extension version 2.9.2
[√] Connected devices (1 available)
• Nexus 6P • 8XV7N16A04000597 • android-arm64 • Android 8.1.0 (API 27)
! Doctor found issues in 1 category.
I've tried downloading the SDK Tools Package and even Installed Android Studio
and added it to PATH, but was unable to resolve the issue.
The current Android installation sits in a directory called C:\NVPACK, and although I do remember fiddling with it, I don't remember which program installed it. I'm considering removing it. Any help would be greatly appreciated.
Flutter provide command to update our Android SDK path:
Use flutter config --android-sdk <path-to-your-android-sdk-path>
Or just add a variable ANDROID_HOME with your sdk location in user variables
It turns out that I had NVIDIA CodeWorks installed. I believe it was part of my VS2017 installation options. I've removed it and modified my ANDROID_HOME Environment Variable and removed all of the variables associated with the NVPACK folder. (thanks to everyone (1) who helped me offsite!)
You have to set ANDROID_HOME variable to SDK.
create a new variable by the name and set it to the installation directory.
make sure SDK is not below 2 subfolders from c drive or any windows root drive.
Open Android Studio.
Click on Tools go to Sdk manager.
Then click on SDK tools.
Unchecked Hide Obsolete Packages then Check Android SDK Tools.
Then Tools will be install after that you can set the path and check the connectivity.
Your problem will resolve.
Go into C:\Users\asus\AppData\Local\Android\sdk, double cliclk on sdk mannager.exe and update all packages.
It will take around 10 minutes to update which also depends on your internet speed.
You need to install the command-line tools inside Android studio, as explained here:
Flutter doctor error - Android sdkmanager tool not found. Windows
For Mac Users use:
flutter config --android-sdk /Users/<your-user>/Library/Android/sdk
I have installed Flutter with Android Studio many times. And I found most of the installation errors were because of poor network connection. When I use fast internet service, Flutter Environment was set up within an hour without any issue.
Internet speed is very important while Flutter, Android Studio, and SDK installation.
Best,
Ahmed I.
1- Activate Command-line Tools and download it as in this picture
2- Add Android SDK path to your system environment variables.
this link would help you..

Categories

Resources