Exception occured when run flutter doctor --android-licenses - flutter

I am a flutter beginer, while installing the android license by command "flutter --android-licenses", I have gotten the exception as follows:
Failed to create settings
Exception in thread "main" java.lang.IllegalArgumentException: port out of range:-1
at java.base/java.net.InetSocketAddress.checkPort(InetSocketAddress.java:153)
at java.base/java.net.InetSocketAddress.<init>(InetSocketAddress.java:198)
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createAddress(SdkManagerCliSettings.java:177)
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.<init>(SdkManagerCliSettings.java:485)
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:58)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:49)
I try to search solution a lot of, but I have no result. So could everyone help me?
Many thanks!

Try my answer here hope its help to you
Or Try below steps:
Open Tools > SDK Manager
From the left choose, Appearance & Behavior > System Settings > Android SDK
Select SDK Tools from the top menu
Check Android SDK Command-line tools and click 'apply'.

Related

why am i getting error accepting android license?

flutter doctor --android-licenses
Error: Could not find or load main class home.Documents..dependencies.android-sdk.cmdline-tools.latest
Caused by: java.lang.ClassNotFoundException: home/Documents//dependencies/android-sdk/cmdline-tools/latest
and it's there! I've checked it, the folder exists
Have enabled command-line tools?
You do this by going into android studio and going to More Actions/SDK Manger/SDK Tools and select command-line tools then click install.
Hope this helps :)

i am getting an error in Android toolchain when i ran flutter doctor

I have started with the setup of flutter updated version and am a total beginner in this platform. This is the error I have been getting. Could you please help me?
You have to install Android SDK Command-line Tools (in SDK Manager).
After Installing, accept the android licensces (in CMD)
flutter doctor --android-licenses
Either install Android Studio to get the required dependecies or download an android sdkmanager and check its path (path/to/sdkmanager should be the path to that).
To avoid any problems for beginners, I would just install Android Studio here, set it up until it installs the android sdk, then switch to Flutter: that was the only way to fix this since some time ago if I remember correctly
Please first run this command
flutter doctor --android-licenses
then follow this link : Android/Sdk is missing a Tools folder, meaing no sdkmanager, meaning "Android license status unknown" error

"flutter pub get" A required privilege is not held by the client

I keep getting this error on Android Studio flutter project, although flutter doctor command shows no issues!
Cannot create link, path = 'C:\Users\UserName\AppData\Local\Pub\Cache\_temp\dir90f89940\ios\Classes\FLTFirebaseAuthPlugin.m'
(OS Error: A required privilege is not held by the client.
, errno = 1314)
pub get failed (66; , errno = 1314))
I tried with pub upgrade which seams to get dependencies correctly and start updating them, but I didn't know why pub get give this error.
Update
A workaround seems to be running Android Studio as administrator!
I have switched ON developer mode in Windows settings (Settings -> Update & security -> For developers) . It worked for me.
Like so:
I'm using vscode I just opened it as administrator and everything works fine.
If you are using Android Studio:
open Android Studio with "Run as administrator"
Just run your PowerShell in administrator mode
the
cd to your project and run
flutter pub get
I wanted to add this solution because when you have accounts managed by your company this is a common problem.
Just go to your quick acces in Start then:
Right Click > More > Open File Location
When the Explorer Opens Right Click again on the AS Icon (quick access), then:
Properties > Advanced ... > Run as Administrator
So you can run always by default as Administrator.
Regards.-
Just run your IDE whether VS Code or Android Studio as Administrator . It solves the issue
Other temporary solution is that making pub cache and then trying flutter pub get.
https://spikez.tistory.com/439
Solution :
1.  flutter pub get
 
 ==> error will be occurred.
[your flutter sdk folder]\flutter.pub-cache_temp\ dir7d36fb45\macos\Classes\FlutterBluePlugin.h' (OS Error: 지정된 파일을 찾을 수 없습니다. , errno = 2)
copy dir7d36fb45  to [your flutter sdk folder]\flutter.pub-cache\hosted\pub.dartlang.org 
change name dir7d36fb45 to flutter_blue-0.8.0
cd flutter_blue-0.8.0 (created by you)
create pubspec.yaml in flutter_blue-0.8.0 folder
fill below content in pubspec.yaml
now you have done preparing flutter_blue cache  :)
lets do, flutter pub get
maybe it will be work.
I know it is a temporary solution. but I believe it will help you understand how to work pub get..
 
If you need new pubspec.yaml ,
you can find out in here  : https://github.com/pauldemarco/flutter_blue/blob/master/pubspec.yaml

Even after updating Flutter doctor says Try re-installing or updating your Android SDK Manager

Here is my Flutter doctor summary:
Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, v1.10.13-pre.12, on Microsoft Windows [Version 10.0.17134.1006], locale en-IN)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
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.5)
[√] Connected device (1 available)
! Doctor found issues in 1 category.
C:\Users\user>
I have already updated My SDK manager to the latest version
My SDK version is 29.0.2
How can I resolve this error... This error appears even after updating SDK manager
Screenshot of SDK Location:
It works for me, Here are the steps that solve my problem:
STEP 1:ANDROID LICENSES --android-licenses, will resolve most cases
Since you are here you have reached "Android License Status Unknown" issue for Android tool chain, as many suggested try flutter doctor --android-licenses. If you are good with all the config. It should ask for an yes and press y and Voila. But if it shows:
Android sdkmanager tool not found (C\Users\__\local\Android\sdk\tools\bin\sdkmanager). Go to step two
STEP 2: SDK Manager installation from Android Studio
Open your Android Studio , File-> settings->System settings(left tab) ->Android SDK, go to SDK Tool section in that page, untick hide obsolete packages, select Android SDL tools(obsolete) and press apply.
It will install the SDK and you confirm it by going and checking if this path exists(C\Users\__\local\Android\sdk\tools\bin\sdkmanager)
STEP 3: Repeat 1
Repeat step 1 after installation in a new command line check if its working , else go to STEP 4
STEP 4: sdkmanager --update
It will ask you update the sdk, just run the command given in terminal
C\Users\__\local\Android\sdk\tools\bin\sdkmanager --update.
If it is running, then its cool. let it finish and repeat step 1, else if it is throwing some exceptions like java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema etc,
It means your java is not installed or not the correct version. Go to next step
STEP 5: JAVA 8.1 and JAVA_HOME path.
Install JAVA 8.1 and set JAVA_HOME path. Make sure it is version 8.1(register free account and download from oracle the 8.1 version, remember above 11+ wont work for Flutter
NOTE: by yaniv maymon: if you already have Java installed on your computer and the sdkmanager --update still not working. go the environment variable and update the "JAVA_HOME" path to jdk folder. then exit the command prompt, open it again and run the update command –
STEP 6: Final Step
After installing and setting up path properly, run the C\Users\__\local\Android\sdk\tools\bin\sdkmanager --update command in new terminal and it will work
STEP 7: Rerun flutter doctor, You can see it saying to run the command flutter doctor --android-licenses . so run flutter doctor --android-licenses in terminal and press y when asked
Resources
It could be that your path is not set correctly? Have you looked in Settings>Appearance and Behavior>System Settings>Android SDK>Android SDK Location?
I had the same problem and solve it installing the latest java version Java 8. Then setting JAVA_HOME Variable. In Windows: Environment Variables> System Variables> add a new or edit your JAVA_HOME> in the Variable Value field, enter your JDK or JRE installation path the JAVA_HOME. After this, the command flutter doctor --android-licenses worked.
According to this issue in the flutter repository it seems like you have not accepted all the SDK license agreements.
You can resolve it by running
flutter doctor --android-licenses
in you terminal and accepting the outstanding licenses by pressing y and return.
I had the same problem
You can resolve this issue by running this command
flutter doctor --android-licenses
into your flutter_console.bat
Or
uninstall the android studio and reinstall it, it will fix the issue.
Add env variable ANDROID_SDK_ROOT as the path where the sdk was installed to.
This solved the problem for me:
open Android Studio and open SDK Manager then SDK Tools tab. check
the box "Android SDK Command-line Tools
Open the command prompt and type flutter doctor --android-licenses then press enter
It is going to ask you to type 'Y' for each license. type 'y' until all the licenses are done.
now check with flutter doctor again in the command prompt and it should tell you that license is accepted.
What worked for me was to delete the Android 30 file in the following directory:
C:\Users\user\AppData\Local\Android\Sdk\platform
After that, I went to File > Settings > System Settings > SDK platforms.
Then I checked the Android 11.0® option, and finally clicked Apply.
Installing Android SDK command line tools in SDKs tools on Android studio worked for me
Open Android Studio and open SDK Manager then SDK Tools tab.
Check the box Android SDK Command-line Tools
After installing Android SDK command line tools in the tools SDKs of Android Studio, execute the command flutter doctor --android-licenses

No valid Android SDK platforms

When I write flutter doctor command in cmd I get this error.
No valid Android SDK platforms found in G:\SdkManager\platforms. Candidates were:
- android-21
- android-27
- android-28
- android-8.0.0
flutter doctor
env
path
flutter sdk
platforms
plugins
It appears as though this message shows up when you don't have any build-tools packages installed. At the time of writing, to install the minimum required versions, you can fix this issue with:
sdkmanager "platform-tools" "platforms;android-30" "build-tools;30.0.3"
I've set up my Android SDK manually on Windows 10 with the command line and I was able to solve this kind of errors while I tried to set up my development environment, if you want to solve it as I did, just follow the next steps that I posted in a GitHub Comment in a related issue:
https://github.com/flutter/flutter/issues/19805#issuecomment-478306166
You should download and install Android build tools for the respective platform versions. This can be done via the Android SDK Manager.
In AndroidStudio go to menu Tool > Android > SDK Manager
On the tab "SDK Platforms" select one or more platforms and click the OK button.
Wait until the download completed and try again.
Try to download all sdk from file-> settings -> sdkmanager.
And do not download manually.
Find your sdk path and execute the code.
$ flutter config --android-sdk <path-to-your-android-sdk-path>
see here
I think your path is incorrect in environment variable.
You should change it to G:/Sdkmanager/platforms