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

Hi,

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 {
        file("libs/armeabi/").mkdirs()
        file("libs/armeabi-v7a/").mkdirs()
        file("libs/x86/").mkdirs()
       //For 64 bit
        file("libs/arm64-v8a/").mkdirs()
        file("libs/x86_64/").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-armeabi.jar")) outputDir = file("libs/armeabi")
            if(jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86")
            //For 64 bit
            if (jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a")
            if(jar.name.endsWith("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.
rotcan
 
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

cron