flutter doctor --android-licenses Error, how to fix this? - java

Error: Could not find or load main class M\AppData\Local\Android\Sdk\cmdline-tools\latest\bin\..
Caused by: java.lang.ClassNotFoundException: M\AppData\Local\Android\Sdk\cmdline-tools\latest\bin\
How to fix this issue?

On macbook big sur with m1 chip this work for me:
Run android studio.
Select configure and click on sdk manager.
Find the "SDK tools" option on android sdk menu.
select and install android SDK commant tools (or "Android SDK (obsolete) founded in other tutorial)"
try run flutter doctor ... again
I hope this work for you :)

You have not installed Android Studio yet, so install Android Studio, and create a new Android emulator. If not,
your Java SDK version might be the problem.
Download JAVA SE 8 from here.
Uninstall any previously installed JDKs and install this anew.
Copy path of \bin of the JDK.
Open Environment Variables in your PC.
Add a new variable JAVA_HOME with the copied value.
Now retry flutter doctor.

Related

You are missing the recommended SDK/JDK/NDK/ Install the recommended version using Unity Hub

So I've been getting these warnings in Unity 2019.410f1. Here's how it looks like:
But when I go to Hub to fix this, those packages are already installed.
However, there are no such folders in the directory where they are supposed to be (except for NDK folder, this one is fine). So here's my problem: JDK, NDK and SDK are NOT installed, but Unity Hub thinks overwise and doesn't let me install them. Reinstalling this version of Unity doesn't help either.
Does anyone know what can I do to fix this?
the bug
There has been a bug in unity forever with those.
The fix is, for jdk, sdk and ndk..
click copy path button,
untick the use version installed with unity box
paste in the path you just copied
(optional, save project and exit and repoen it)
Then just retick the boxes to put it back the way it was originaly
I dont think you are having this bug tho, your problem sounds different.
uninstall / reinstall
I'm really suprised uninstalling unity and reinstalling didnt fix it.
Maybe try uninstalling all versions of unity + unity hub, restart machine and start again installing unity hub.
Manually download
If nothing else works I think this would, but its not pretty..
Manually download sdk, jdk and ndk, untick the boxes and add the paths where you have put them. The jdk and ndk can just be downloaded.
jdk https://www.oracle.com/java/technologies/downloads/
ndk https://developer.android.com/ndk/downloads
But to get the sdk you have to install android studio, then download all the individual packages using the sdk manager (which is a tiny hard to find icon!)
Here's the steps I used to fix this:
Install and Open Android Studio
Open the SDK Manager
Copy the Android SDK Location (the SDK Manager shows this path)
Optionally install any SDKs you want using the SDK manager
Create a Symlink to point from the default Unity SDK folder to the default Android Studio SDK folder
On Windows, here's a symlink command you can use. You'll need to change the command to match the user on your system.
mklink /D "C:\Program Files\Unity\Hub\Editor\2020.3.20f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK" "C:\Users\YOUR_USER_HERE\AppData\Local\Android\Sdk"
Lastly, I had to refresh Unity to make the warning message go away.
Open Unity -> Edit -> Preferences -> External Tools -> uncheck & re-check the Android SDK Tools
For me Unity 2021.3.6f1. I fixed by changing the permission of the whole unity editor folder:
sudo chmod -R 777 Editor/
It was a bit extreme, but it worked for me.
It was the editor 2021.3.6f1 ubuntu 22.04
For me (Unity 2021.2.18f1) the problem happened because the NDK field's default value was wrong. The NDK was correctly downloaded by Unity but the path in Unity Editor was wrong so I changed the path to the correct one.
I could reproduce this error when installing older Unity Versions (for me 2020.3.25f1) with Unity Hub 3.x. For some reason the newer Unity Hub doesn't install Android SDK & NDK and OpenJDK for older Unity versions. It's a weird bug, but happened to me every time and on different machines. Possible Workarounds:
Manually install Android SDK, NDK & JDK and locate path in Unity Editor
Use Unity Hub 2.X when installing older Unity Versions
Install newer Unity Editor (e.g. 2021.3.10f1). For some reason sdk, ndk and jdk are properly installed here. You can either copy it over to the other Unity Editor installation (Might get a filename too long exception though) or just link to the path from the 2021 installation in your 2020 editor. Pay attention to the required version though. If there's a version missmatch this workaround doesn't work.
All in all weird bug, weird workarounds but for me all of them worked with the last one being the most convenient since I usually have the newest recommended version installed anyway :)

Flutter android licenses acceptance error

I am trying to accept flutter android licenses using flutter doctor --android-licenses but I keep getting the error in the image below.
I have combed the internet for about 2 days but not getting a workaround. Any help to solving this will be greatly appreciated.
You will have to install android commandline tools from the sdk manager. Then it will not cause the error again:
You can install and update each package using Android Studio's SDK Manager or the SDK manager command-line tool. All of the packages are downloaded into your Android SDK directory, which you can locate as follows:
This is because you are probably using a new version of JDK. Building Android applications require JDK version 8 and only 8.
Try removing current JDK from your environment variables (path and JAVA_HOME) and installing JDK 8 instead. Remember to add JDK 8 to both your environment variables path and as JAVA_HOME.
This will probably fix your problem.

Android SDK license issue prevents build of LibGDX project in IntelliJ

After reinstalling Windows 10, I am desperately trying to get my LibGDX project to run in IntelliJ again. It will not build because of an Android SDK license issue.
I reinstalled Android Studio and the Android SDK 27, which I had been using in my project before, but I got the following error message:
A problem occurred configuring project ':android'.
Failed to install the following Android SDK packages as some licences have not been accepted.
platform-tools Android SDK Platform-Tools
patcher;v4 SDK Patch Applier v4
platforms;android-27 Android SDK Platform 27
build-tools;27.0.3 Android SDK Build-Tools 27.0.3
emulator Android Emulator
tools Android SDK Tools
I found the following thread with lots of suggested fixes:
"Failed to install the following Android SDK packages as some licences have not been accepted" error
So I learned that I have to run
%ANDROID_HOME%/tools/bin/sdkmanager --licenses
It did not work at first because the file /users/MYUSERNAME/.android/repositories.cfg was missing. I created an empty file at that path, ran sdkmanager again and accepted all licenses. However, I still get the same error when building my LibGDX project in IntelliJ.
Here is what I have tried to resolve this issue:
Ran sdkmanager --licenses with administrator priviledges
Ran sdkmanager --update instead of --licenses
Installed the Android command line tools and used that sdkmanager batch file instead
Made sure that the %ANDROID_HOME%\licenses folder exists and contains license files
Made sure that there is not another Android SDK installed on my machine that I am not aware of - both ANDROID_HOME and ANDROID_SDK_ROOT (I read that the former is outdated) environment variables point to the same folder that is also configured as Android SDK location in the Android Studio SDK Manager and as an Android SDK home path in my IntelliJ project settings
Selected the JRE that comes with Android Studio as the standard Java runtime environment on my machine (by setting JAVA_HOME to C:\Program Files\Android\Android Studio\jre)
Uninstalled the API 30 SDK that was automatically installed with Android Studio, so I would only have API 27 left
Tried using the API 30 SDK instead of API 27 by configuring it in the android\build.gradle file of my LibGDX project
Uninstalled Android Studio, removed the SDK folder and reinstalled everything
Added yes | sdkmanager --licenses to my gradlew.bat
None of these seemed to help. When I run sdkmanager --licenses again, the response is
All SDK package licenses accepted.
but IntelliJ keeps saying the opposite.
I am out of ideas how to resolve this. Any help would be highly appreciated.
The issue was most likely due to an incompatibility of the outdated Gradle version with some other dependency, possibly the Android SDK. I resolved it by migrating my project to the newest LibGDX version (1.9.11).
My game would not run with the Gradle wrapper configured in gradle/wrapper/gradle-wrapper.properties (version 5.4.1) because I got another error message ("Could not open cp_init remapped class cache"), so I switched to the latest Gradle version, which is locally installed (6.5.1): Settings -> Build, Execution, Deployment -> Build Tools -> Gradle -> Use Gradle from: Specified location
I also downloaded the Android API from 30 to 29, as that is the version recommended for use with LibGDX 1.9.11. However, I did not have to use the command line tool to accept the licenses anymore.

Eclipse cannot create new Android Application Project after updating the Android SDK Tools

today i update the android SDK Tools to rev22.2
and then i can't create new android application project.
it tells me that the Android Support library is either not installed or need to update.
but ver.18 is the newest version of Android Support library!
i pressed the Install/Upgrade button but nothing happened.
i used Android SDK manager tried to uninstall and install the android support library again, restart the Eclipse, restart the computer, but all these can't fix the situation.
now i don't know what to do...
the version of Eclipse is Kepler ver.4.3.0
Yes , I had the same problem . You need to update your ADT version
Start Eclipse, then select Help > Install New Software.
Click Add, in the top-right corner.
In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the following URL for the Location:
https://dl-ssl.google.com/android/eclipse/

IntelliJ IDEA 12 - Incompatible Android version error

I'm starting out Android development with IntelliJ IDEA 12.0.
I have installed and configured JDK and Android SDK. I wanted to target Android SDK 2.3.3 so the SDK is configured as in the screenshot.
When I try and run the project though, I'm getting the following error:
android-validator: [untitled] Incompatible version of Android SDK Platform-tools package. Min version is 11. Please, update it though SDK manager
Followed by
android-validator: [untitled] Incompatible version of Android SDK Tools package. Min version is 19. Please, update it though SDK manager
I wasn't able to find any information on this and not sure what this means. Any pointers is appreciated.
--New project config--
--Install Android Packages--
android-validator: [untitled] Incompatible version of Android SDK
Platform-tools package. Min version is 11. Please, update it though
SDK manager
Because you have revision 10 and the IntelliJ IDEA tool needs revision 11
android-validator: [untitled] Incompatible version of Android SDK
Tools package. Min version is 19. Please, update it though SDK manager
Because you have revision 16 and the IntelliJ IDEA tool needs revision 19
The mentioned minimal revisions are requirements for IntelliJ IDEA to provide Android tools and to compile your applications. You should definitly launch again the Android SDK Manager and check the Tools folder, as on your screenshot, and click on "Install 2 packages".
I had the same issue. I updated "Android SDK Platform-tools" but it didn't work.
After that I realized that in the past I set c:\Android\android-sdk as the SDK folder. But the SDK manager was updating the folder named c:\Documents and Settings\my.user\Local Settings\Application Data\Android\android-sdk So IntelliJ was checking the old folder.
Problem solved after changing to right folder. So be sure that you set new folder if you have such issue. Check help documentation for setting the SDK folders: http://www.jetbrains.com/idea/webhelp/configuring-global-project-and-module-sdks.html

Categories