Flutter android licenses acceptance error - java

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.

Related

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

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.

What is the latest Java SDK that can be used for Android app development?

I recently bought a new MacBook. I installed the Android SDK and Studio and then I imported my project. AS suggested to use the bundled Open JDK for my project. I accepted and I am able to build and run my project via AS.
The problem is, my command line doesn't work :(
==> ./gradlew clean
No Java runtime present, requesting install.
After running the above code the following alert displays. This web page will be open when I click on the More Info button.
After I searched I realized that I have to have JDK installed on my laptop. I remember -from thousand years ago- that I have to have JDK 8 on my laptop. I also heard that android projects work with JDK 11.
It looks like the latest JDK is 15. So, what should I do? What is the latest JDK that can be used for Android app development?
Anything Java 8 or above is fine.
Find path to JDK in File > Project Structure, Tab SDK Location > JDK Location.
In MacOS, installed Virtual Machines are normally placed in /Library/Java/JavaVirtualMachines/*

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.

NativeScript: Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later [duplicate]

I've installed NativeScript and I try to do tns platform add android but it doesn't work. ANDROID_HOME path is correct and I have installed SDK (API 22 and the newest one) and tools (25.0.2). When I run tns doctor it says:
WARNING: The Android SDK is not installed or is not configured properly.
Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later.
You need to have the Android SDK Build-tools installed on your system. You can install any version in the following range: '>=25.0.2'.
You need to have Android SDK 22 or later and the latest Android Support Repository installed on your system.
The current version of NativeScript 2.5.2 requires certain tools to be in the Android home directory so that it can detect them. The newest version of Android SDK (Mar 2017) actually removed the primary android support file and moved several binary files into other directories to clean things up.
Unfortunately this causes NativeScript to not be able to detect that you have the SDK. This version of the SDK came out AFTER the current version of NativeScript.
The simplest way to fix this that I can think of is to start from the command line; sdkmanager then choose to download the older 25.2.3 tools.
To manually do this; you would need to delete everything in your sdk/tools folder and download:
https://dl.google.com/android/repository/tools_r25.2.3-windows.zip (Windows)
https://dl.google.com/android/repository/tools_r25.2.3-macosx.zip (Macintosh)
https://dl.google.com/android/repository/tools_r25.2.3-linux.zip (Linux)
Then extract these into that sdk/tools directory.
I solved this using the SDK manager in Android Studio, having already installed it previously, install all the requirements, namely
tools,platform-tools,android-25,build-tools-25.0.2,extra-android-m2repository,extra-google-m2repository,extra-android-support
Once installed change your ANDROID_HOME environment variable to point to this SDK manager. Typically, it will be at (/Users//Library/Android/sdk)
export ANDROID_HOME=/Users/<user_name>/Library/Android/sdk
Confirm that NativeScript detects your changes by running
tns doctor

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