Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use relinker in Android #158

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/kotlin/gdx/liftoff/data/platforms/Android.kt
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ dependencies {
} else {
""
}}
${joinDependencies(dependencies)}
${joinDependencies(dependencies + "\"com.getkeepsafe.relinker:relinker:1.4.5\"")}
${joinDependencies(nativeDependencies, "natives")}
}

Expand Down
3 changes: 3 additions & 0 deletions src/main/kotlin/gdx/liftoff/data/templates/KotlinTemplate.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand All @@ -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.
})
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/kotlin/gdx/liftoff/data/templates/Template.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand All @@ -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);
}
Expand Down
Loading