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.
Related
"General error during conversion: Unsupported class file major version 63"
I've tried multiple suggestions on here. None have worked. I think I need more of a step-by-step solution because I've tried installing multiple versions of Java (19,16,11), flutter clean, flutter doctor is all good, and I've installed a newer version of Android Studio (just in case). Here is what I see in VSCode:
I encountered this error while trying to run Flutter integration tests on Firebase Test Lab. I was able to solve this by updating a few things in Android Studio.
Update the Project's JDK
Open the Android Studio project settings page (File -> Project Settings) and add the newest JDK version.
Update com.android.tools.build:gradle
In android/build.gradle, update the com.android.tools.build:gradle value to the latest version found here.
dependencies {
classpath 'com.android.tools.build:gradle:7.4.1'
...
}
Update the gradle distributionUrl
In android/gradle/wrapper/gradle-wrapper.properties, update the distributionUrl property to use the latest Gradle version.
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip
Other Useful Tips
You can type /usr/libexec/java_home into the terminal to see which version of Java you have installed.
You can find the current value of JAVA_HOME by running %echo $JAVA_HOME in your terminal (source).
You can update JAVA_HOME by following these steps
The problem is that somehow, either deliberately or inadvertently, you've built one or more Java files (or you're using one or more 3rd party .jars) with Java 19 ... but your "build environment" is using an older JRE. Hence the Unsupported class file error.
I, too, am using VSCode for my Flutter IDE; and I, too have Android Studio in my environment. Unfortunately, there are constantly new releases for Flutter, for VSCode, for the Android SDK, for Android Studio (with its own embedded Java/Kotlin!) and - last, but not least - for Gradle and the A/S Gradle plugin. Any one of them falling out of sync can break your entire development environment :(
I just tried to rebuild a project that compiled fine a few months ago... and (as expected) the build failed. None of the source change - but I recently upgraded A/S, and that inadvertently broke the Flutter build :(
SUGGESTION:
See if you can identify which Java class or .jar is using Java 19 ... and back it down to an older version.
In parallel, upgrade EVERYTHING in your build environment:
flutter upgrade => Flutter 3.7.3, Dart 2.19.2
VSCode update, pub upgrade => VSCode 1.751, Dart Code 3.58.0
A/S upgrade => Electric Eel 2022.1.1 Patch 1, Gradle Plugin 4.2.2
Note: Gradle Plugin 4.2.2 => Gradle version => 6.7.1, Default=Java8, AGP dependency 4.2.2
A/S Electric Eel gives you java 11... in (new!) directory "c:\Program Files\Android\Android Studio\jbr"
I am using the latest version of Android studio V4.1 to implement my project on Windows 10.
The project also requires Java 11 and Ndk libraries.
First, I installed NDK V22 and V16 as well as Cmak from SDK tools in SKD manger as shown below:
Then, Installed Java 11 from Oracel.com, and checked using cmd as shown below:
I added the paths of SDK and NDK to the local.properties files as follows:
sdk.dir=C\:\\Users\\user_name\\AppData\\Local\\Android\\Sdk
ndk.dir=C\:\\Users\\user_name\\AppData\\Local\\Android\\Sdk\\ndk\\22.0.7026061
Also, added JAVA_HOME and ANDROID_NDK_HOME in the system environment.
The problem is that I can not locate the NDK path from the "File > project structure> Android NDK location" in the Android project to tell the Android studio where is the NDK is located. It always shows as inactive and can not browse the path as shown in the below picture:
Info:
Android Gradle Plugin Version 4.1.1
Gradle Version 6.8
Can anyone help to fix this problem?
This was moved to the build.gradle to keep builds reproducible: https://developer.android.com/studio/releases/gradle-plugin#ndk-path
It's not in the UI because you should almost never use it. You should be using android.ndkVersion in almost all cases. android.ndkPath (and ndk.dir) is just a way to make builds non-reproducible/non-portable.
The cases where android.ndkPath makes sense are if your CI service only has the NDK installed to a specific location not known to the SDK, or if you're using an unreleased NDK.
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
I am trying to update my Eclipse to Android Lollipop. I am done with downloading the required SDK and installing the same. My problem is that after doing this when I try to create a new project for Android 5.0 it does not list it in the Target SDk drop down. However, When I go to the android folder where I have downloaded the latest SDK and run it it does enlist Android 5.0 there but does not show it when I run SDK Manager from eclipse. I have done lot of troubleshooting like re-installing the whole eclipse again and followed steps given in various same kind of questions but nothing seems working for me.
You have to right click on your project in Eclipse --> Properties --> Android --> Project Build Target and then select Android 5.0.1.
Also you may need to check AndroidManifest.xml for the targetSdkVersion value and target attribute in your project.properties file.
Clean and build your project and you will be fine.
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