phancuongviet
phancuongviet

Reputation: 435

Exception occured when run flutter doctor --android-licenses

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!

Upvotes: 1

Views: 306

Answers (2)

pHagi
pHagi

Reputation: 208

Had the same problem and the suggested fixes/workarounds didn't help. So I scannt the source code of SdkManagerCliSettings and found the problem is related to the handling of proxy settings.

My solution was to add the correct proxy settings via an environment variable.

export HTTPS_PROXY=proxy.sample.com:3128

Upvotes: 0

Ravindra S. Patil
Ravindra S. Patil

Reputation: 14865

Try my answer here hope its help to you

Or Try below steps:

  1. Open Tools > SDK Manager
  2. From the left choose, Appearance & Behavior > System Settings > Android SDK
  3. Select SDK Tools from the top menu
  4. Check Android SDK Command-line tools and click 'apply'.

Upvotes: 1

Related Questions