diff --git a/src/main/kotlin/gdx/liftoff/data/platforms/Android.kt b/src/main/kotlin/gdx/liftoff/data/platforms/Android.kt index de19f0b3..60dad666 100644 --- a/src/main/kotlin/gdx/liftoff/data/platforms/Android.kt +++ b/src/main/kotlin/gdx/liftoff/data/platforms/Android.kt @@ -217,7 +217,7 @@ dependencies { } else { "" }} -${joinDependencies(dependencies)} +${joinDependencies(dependencies + "\"com.getkeepsafe.relinker:relinker:1.4.5\"")} ${joinDependencies(nativeDependencies, "natives")} } diff --git a/src/main/kotlin/gdx/liftoff/data/templates/KotlinTemplate.kt b/src/main/kotlin/gdx/liftoff/data/templates/KotlinTemplate.kt index a1dfe21b..b6f91c93 100644 --- a/src/main/kotlin/gdx/liftoff/data/templates/KotlinTemplate.kt +++ b/src/main/kotlin/gdx/liftoff/data/templates/KotlinTemplate.kt @@ -48,6 +48,8 @@ import android.os.Bundle import com.badlogic.gdx.backends.android.AndroidApplication import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration +import com.badlogic.gdx.backends.android.GdxNativeLoader +import com.getkeepsafe.relinker.ReLinker import ${project.basic.rootPackage}.${project.basic.mainClass} /** Launches the Android application. */ @@ -56,6 +58,7 @@ class AndroidLauncher : AndroidApplication() { super.onCreate(savedInstanceState) initialize(${project.basic.mainClass}(), AndroidApplicationConfiguration().apply { // Configure your application here. + nativeLoader = GdxNativeLoader { ReLinker.loadLibrary(this, "gdx") } useImmersiveMode = true // Recommended, but not required. }) } diff --git a/src/main/kotlin/gdx/liftoff/data/templates/Template.kt b/src/main/kotlin/gdx/liftoff/data/templates/Template.kt index 77efaa95..01c10609 100644 --- a/src/main/kotlin/gdx/liftoff/data/templates/Template.kt +++ b/src/main/kotlin/gdx/liftoff/data/templates/Template.kt @@ -218,6 +218,7 @@ import android.os.Bundle; import com.badlogic.gdx.backends.android.AndroidApplication; import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; +import com.getkeepsafe.relinker.ReLinker; import ${project.basic.rootPackage}.${project.basic.mainClass}; /** Launches the Android application. */ @@ -226,6 +227,7 @@ public class AndroidLauncher extends AndroidApplication { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); AndroidApplicationConfiguration configuration = new AndroidApplicationConfiguration(); + configuration.nativeLoader = () -> ReLinker.loadLibrary(this, "gdx"); configuration.useImmersiveMode = true; // Recommended, but not required. initialize(new ${project.basic.mainClass}(), configuration); }