Upgrading LibGDX from 1.7.1 to 1.14.2


I am trying to recover an old LibGDX project for publishing to the Play Store.

The project was saved at LibGDX 1.7.1. I got it working on my phone again at 1.9.10 but then I needed to upgrade again to make publishing to the Play Store work.

Currently I upgraded most of my project again:

  • Android Studio Quail 2 (2026.1.2), July 9 2026

  • Java 8 -> Java 17 (using Eclipse Adoptium: 17.0.19.10-hotspot)

  • Gradle 8.9.1 (gradle-8.11.1-all.zip)

  • LibGDX 1.14.2 with GDX FreeType

  • Play Services Auth 20.7.0 (android.gms:play-services-auth:20.7.0)

compileSdk 36
targetSdk 35
gdxVersion = '1.14.2'
roboVMVersion = '1.9.0'
box2DLightsVersion = '1.4'
ashleyVersion = '1.6.0'
aiVersion = '1.6.0'

Current status

Build Successful - but when running many errors appear in the build window.

Below is just the first part of errors, it keeps going on and on with Variant declares a library, etc.

How to proceed from here? Any ideas?

Execution failed for task ':android:checkDebugAarMetadata'.
> Could not resolve all files for configuration ':android:debugRuntimeClasspath'.
   > Could not resolve androidx.annotation:annotation:1.8.1.
     Required by:
         project :android > com.badlogicgames.gdx:gdx-backend-android:1.14.2 > androidx.core:core:1.17.0
      > No matching variant of androidx.annotation:annotation:1.8.1 was found. The consumer was configured to find a library for use during runtime, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.9.1', attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - Variant 'androidNativeArm32ApiElements-published' declares a library:
              - Incompatible because this component declares a component for use during 'kotlin-api', as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native' and the consumer needed a component for use during runtime, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm'
              - Other compatible attributes:
                  - Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '8.9.1')
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
                  - Doesn't say anything about its target Java environment (preferred optimized for Android)
          - Variant 'androidNativeArm32SourcesElements-published':
              - Incompatible because this component declares documentation for use during 'kotlin-runtime', as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native' and the consumer needed a library for use during runtime, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm'
              - Other compatible attributes:
                  - Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '8.9.1')
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
                  - Doesn't say anything about its target Java environment (preferred optimized for Android)
          - Variant 'androidNativeArm64ApiElements-published' declares a library:
              - Incompatible because this component declares a component for use during 'kotlin-api', as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native' and the consumer needed a component for use during runtime, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm'
              - Other compatible attributes:
                  - Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '8.9.1')
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
                  - Doesn't say anything about its target Java environment (preferred optimized for Android)
          - Variant 'androidNativeArm64SourcesElements-published':
              - Incompatible because this component declares documentation for use during 'kotlin-runtime', as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native' and the consumer needed a library for use during runtime, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm'
              - Other compatible attributes:
                  - Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '8.9.1')
                  - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'debug')
                  - Doesn't say anything about its target Java environment (preferred optimized for Android)

gradle.properties

org.gradle.daemon=true
org.gradle.jvmargs=-Xms128m -Xmx512m
org.gradle.configureondemand=false
android.useDeprecatedNdk=false
android.useAndroidX=true
android.enableJetifier=true
org.gradle.java.home=C:\\Program Files\\Eclipse Adoptium\\jdk-17.0.19.10-hotspot

build.gradle:

buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:8.9.1'
    }
}

allprojects {    version = '1.2'
    ext {
        appName = "APP"
        gdxVersion = '1.14.2'
        roboVMVersion = '1.9.0'
        box2DLightsVersion = '1.4'
        ashleyVersion = '1.6.0'
        aiVersion = '1.6.0'
    }

    repositories {
        google()
        mavenCentral()
    }
}

project(":android") {
    apply plugin: 'com.android.application'

    configurations { natives }

    dependencies {
        implementation project(":core")
        implementation "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"

        // x32 support
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"

        // x64 support
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"

        implementation "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"

        // x32 support
		natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
		natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"

        // x64 support
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a"
        natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64"
    }
}

project(":core") {
    apply plugin: "java"

    dependencies {
        implementation "com.badlogicgames.gdx:gdx:$gdxVersion"
        implementation "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
    }
}

android/build.gradle:

//apply plugin: "android"
apply plugin: "com.android.application"
//apply plugin: 'com.google.gms.google-services'

android {
    namespace "com.x"
    signingConfigs {
        config {
            //
        }
    }
    compileSdk 36
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        applicationId "com.x"
        minSdk 21
        targetSdk 35
    }
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
            jniLibs.srcDirs = ['libs']
        }

        androidTest.setRoot('tests')
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                    'proguard-project.txt'
            signingConfig signingConfigs.config
        }
    }
}


// called every time gradle gets executed, takes the native dependencies of
// the natives configuration, and extracts them to the proper libs/ folders
// so they get packed with the APK.
task copyAndroidNatives() {
    file("libs/armeabi-v7a/").mkdirs();
    file("libs/x86/").mkdirs();

    file("libs/arm64-v8a").mkdirs()

    configurations.natives.files.each { jar ->
        def outputDir = null
        if (jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a")
        if (jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86")

        if (jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a")
        if (outputDir != null) {
            copy {
                from zipTree(jar)
                into outputDir
                include "*.so"
            }
        }
    }
}
task run(type: Exec) {
    def path
    def localProperties = project.file("../local.properties")
    if (localProperties.exists()) {
        Properties properties = new Properties()
        localProperties.withInputStream { instr ->
            properties.load(instr)
        }
        def sdkDir = properties.getProperty('sdk.dir')
        if (sdkDir) {
            path = sdkDir
        } else {
            path = "$System.env.ANDROID_HOME"
        }
    } else {
        path = "$System.env.ANDROID_HOME"
    }

    def adb = path + "/platform-tools/adb"
    commandLine "$adb", 'shell', 'am', 'start', '-n', 'com.x/com.x.android.AndroidLauncher'
}

dependencies {
    implementation 'com.google.android.gms:play-services-auth:20.7.0' // 21.3.0'

    implementation fileTree(dir: 'libs', include: '*.jar')
}
-1
Jul 18 at 5:18 PM
User AvatarZ0q
#java#android#gradle#libgdx

No answer found for this question yet.