Android 64-bit Versioning

Any community contributions to libgdx go here! Some may get included in the core API when permission is granted.

Re: Android 64-bit Versioning

Postby rotcan » Mon Jun 10, 2019 12:05 pm


In build.gradle, add reference for 64 bit libraries. Below is an example for reference

For main project build gradle, add the following lines for 64bit
Code: Select all
project(":android") {
    apply plugin: "android"

    configurations { natives }

    dependencies {
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
        // For 64 bit
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"

        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
      // for 64 bit
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-arm64-v8a"
        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86_64"

Then in android build gradle, add following lines for 64bit
Code: Select all
task copyAndroidNatives {
    doFirst {
       //For 64 bit

        configurations.natives.files.each { jar ->
            def outputDir = null
            if ("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a")
            if("natives-armeabi.jar")) outputDir = file("libs/armeabi")
            if("natives-x86.jar")) outputDir = file("libs/x86")
            //For 64 bit
            if ("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a")
            if("natives-x86_64.jar")) outputDir = file("libs/x86_64")

Rebuild the project again, and you should see arm64-v8a and x86_64 folders in android/libs folder.

Hope it helps.
Posts: 1
Joined: Mon Jun 10, 2019 10:32 am

Return to Libgdx Contributions

Who is online

Users browsing this forum: No registered users and 1 guest