Fix error

This commit is contained in:
khanhduytran0 2020-09-01 07:58:03 +07:00
parent 958e22f0a3
commit 79f513a25f
5 changed files with 29 additions and 45 deletions

View File

@ -50,9 +50,9 @@ deploy:
api-key: $GITHUB_API_KEY
file: $TRAVIS_BUILD_DIR/app/build/outputs/apk/debug/app-debug.apk
skip_cleanup: true
name: PojavLauncher_DevBuild-$TRAVIS_COMMIT
name: PojavLauncher-v3_DevBuild-$TRAVIS_COMMIT
body: Automatic build of PojavLauncher from the latest source commit ($TRAVIS_COMMIT) built by Travis CI on $(date +'%F %T %Z').
prerelease: true
overwrite: true
target_commitish: $TRAVIS_COMMIT
on: [push]
# on: [push]

View File

@ -6,7 +6,8 @@ A Minecraft: Java Edition launcher for Android based from Boardwalk. Support up-
## Current status
- [x] **Removed** ~~BinaryExecutor: execute `java` binary, no `JNIInvocation`.~~
- [x] JVDroid OpenJDK 11 (32 and 64-bit ARM and x86). Partial, no error `can't lock mutex`, but now exit with none output.
- [x] **Temporary removed** ~~JVDroid OpenJDK 11 (32 and 64-bit ARM and x86). Partial, no error `can't lock mutex`, but now exit with none output.~~
- [x] OpenJDK 9 Mobile port
- [ ] AWT/Swing for mod installer. Will use `Caciocavallo` project.
- [ ] OpenGL in OpenJDK environment. Use Boardwalk 2 method or other.
- [ ] OpenAL 64-bit version

View File

@ -2,6 +2,7 @@ package net.kdt.pojavlaunch;
import android.system.*;
import java.io.*;
import android.content.*;
// This class should be named as 'LoadMe' as original
public class BinaryExecutor
@ -29,19 +30,36 @@ public class BinaryExecutor
// return fd;
}
public static void setJavaEnvironment() {
public static void setJavaEnvironment(Context ctx) throws IOException, ErrnoException {
String libName = System.getProperty("os.arch").contains("64") ? "lib64" : "lib";
String ldLibraryPath = (
// To make libjli.so ignore re-execute
Tools.homeJreDir + "/lib/server:" +
"/system/" + libName + ":" +
"/vendor/" + libName + ":" +
"/vendor/" + libName + "/hw:" +
ctx.getApplicationInfo().nativeLibraryDir + ":" +
Tools.homeJreDir + "/lib/jli:" +
Tools.homeJreDir + "/lib"
);
setEnvironment("JAVA_HOME", Tools.homeJreDir);
setEnvironment("HOME", Tools.MAIN_PATH);
setEnvironment("TMPDIR", getCacheDir().getAbsolutePath());
setEnvironment("TMPDIR", ctx.getCacheDir().getAbsolutePath());
// setEnvironment("LIBGL_MIPMAP", "3");
setEnvironment("MESA_GLSL_CACHE_DIR", getCacheDir().getAbsolutePath());
setEnvironment("MESA_GLSL_CACHE_DIR", ctx.getCacheDir().getAbsolutePath());
setEnvironment("LD_LIBRARY_PATH", ldLibraryPath);
setEnvironment("PATH", Tools.homeJreDir + "/bin:" + Os.getenv("PATH"));
setLdLibraryPath(ldLibraryPath);
}
private static void setEnvironment(String name, String value) throws ErrnoException, IOException {
if (MainActivity.LAUNCH_TYPE == MainActivity.LTYPE_PROCESS) {
mLaunchShell.writeToProcess("export " + name + "=" + value);
MainActivity.mLaunchShell.writeToProcess("export " + name + "=" + value);
} else {
Os.setenv(name, value, true);
}

View File

@ -69,24 +69,8 @@ public class InstallModActivity extends AppCompatActivity
javaArgList.add("-jar");
javaArgList.add(modFile.getAbsolutePath());
String libName = System.getProperty("os.arch").contains("64") ? "lib64" : "lib";
String ldLibraryPath = (
// To make libjli.so ignore re-execute
Tools.homeJreDir + "/lib/server:" +
"/system/" + libName + ":" +
"/vendor/" + libName + ":" +
"/vendor/" + libName + "/hw:" +
getApplicationInfo().nativeLibraryDir + ":" +
Tools.homeJreDir + "/lib/jli:" +
Tools.homeJreDir + "/lib"
);
BinaryExecutor.setJavaEnvironment();
BinaryExecutor.redirectStdio();
BinaryExecutor.setLdLibraryPath(ldLibraryPath);
BinaryExecutor.setJavaEnvironment(this);
BinaryExecutor.initJavaRuntime();
BinaryExecutor.chdir(Tools.MAIN_PATH);

View File

@ -948,7 +948,7 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
return args;
}
private ShellProcessOperation mLaunchShell;
public static ShellProcessOperation mLaunchShell;
private static void startStrace(int pid) throws Exception {
String[] straceArgs = new String[] {"/system/bin/strace",
@ -1029,25 +1029,7 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
mLaunchShell.initInputStream(this);
}
String libName = System.getProperty("os.arch").contains("64") ? "lib64" : "lib";
String ldLibraryPath = (
// To make libjli.so ignore re-execute
Tools.homeJreDir + "/lib/server:" +
"/system/" + libName + ":" +
"/vendor/" + libName + ":" +
"/vendor/" + libName + "/hw:" +
getApplicationInfo().nativeLibraryDir + ":" +
Tools.homeJreDir + "/lib/jli:" +
Tools.homeJreDir + "/lib"
// "$JAVA_HOME/lib:$JAVA_HOME/lib/jli:$JAVA_HOME/lib/server"
);
BinaryExecutor.setJavaEnvironment();
BinaryExecutor.setJavaEnvironment(this);
// can fix java?
// setEnvironment("ORIGIN", Tools.homeJreDir + "/lib");
@ -1094,7 +1076,6 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
}
}, "RuntimeLogThread").start();
BinaryExecutor.setLdLibraryPath(ldLibraryPath);
BinaryExecutor.initJavaRuntime();
BinaryExecutor.chdir(Tools.MAIN_PATH);