0

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.

stefanS
  • 312
  • 4
  • 17
  • Do you use IntelliJ IDEA or Android Studio for developing the application? Does it work if you [create an empty Android project](https://www.jetbrains.com/help/idea/creating-a-new-android-project.html) through the IntelliJ IDEA wizard? What ["Android SDK Location"](https://prnt.sc/tpx9ii) path do you see in Android SDK settings? – Egor Klepikov Jul 28 '20 at 13:38
  • As I wrote in the title, I am using IntelliJ to work on my LibGDX project. I only installed Android Studio because I had to to get the Android SDK running. My Android SDK location is `C:\Tools\Android`, which is the directory that contains `build_tools`, `emulator`, `licenses` etc. I tried creating an empty Android project (your link is broken by the way), but it will not build because my Gradle version (4.10.2) seems to be outdated. However, LibGDX does not seem to support Gradle above 4.X, so there must be a way to get it running with the Android SDK... – stefanS Jul 30 '20 at 21:13

1 Answers1

0

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.

stefanS
  • 312
  • 4
  • 17