Fix ld library path (1/2)

This commit is contained in:
Tran Khanh Duy 2020-11-05 19:28:48 +07:00 committed by GitHub
parent 96f71d65f9
commit ffd740ffdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -120,7 +120,9 @@ public class JREUtils
Log.i("jrelog-logcat","Logcat thread started"); Log.i("jrelog-logcat","Logcat thread started");
} }
public static void relocateLibPath() { public static void relocateLibPath(Context ctx) {
nativeLibDir = ctx.getApplicationInfo().nativeLibraryDir;
for (String arch : Tools.currentArch.split("/")) { for (String arch : Tools.currentArch.split("/")) {
File f = new File(Tools.homeJreDir, "lib/" + arch); File f = new File(Tools.homeJreDir, "lib/" + arch);
if (f.exists() && f.isDirectory()) { if (f.exists() && f.isDirectory()) {
@ -149,8 +151,6 @@ public class JREUtils
} }
public static void setJavaEnvironment(Context ctx, int launchType) throws Throwable { public static void setJavaEnvironment(Context ctx, int launchType) throws Throwable {
nativeLibDir = ctx.getApplicationInfo().nativeLibraryDir;
setEnvironment(launchType, "JAVA_HOME", Tools.homeJreDir); setEnvironment(launchType, "JAVA_HOME", Tools.homeJreDir);
setEnvironment(launchType, "HOME", Tools.MAIN_PATH); setEnvironment(launchType, "HOME", Tools.MAIN_PATH);
setEnvironment(launchType, "TMPDIR", ctx.getCacheDir().getAbsolutePath()); setEnvironment(launchType, "TMPDIR", ctx.getCacheDir().getAbsolutePath());