fix(injectDex): Fixed the crash issue of the injection loader on some Android.
https://github.com/JingMatrix/LSPatch/pull/68
This commit is contained in:
parent
5c8509e4f5
commit
efeb758845
|
|
@ -101,7 +101,23 @@ public class LSPAppComponentFactoryStub extends AppComponentFactory {
|
||||||
transfer(is, os);
|
transfer(is, os);
|
||||||
dex = os.toByteArray();
|
dex = os.toByteArray();
|
||||||
}
|
}
|
||||||
soPath = cl.getResource("assets/npatch/so/" + libName + "/libnpatch.so").getPath().substring(5);
|
java.net.URL url = cl.getResource("assets/npatch/so/" + libName + "/libnpatch.so");
|
||||||
|
if (url == null) {
|
||||||
|
throw new RuntimeException("Should not happen: libnpatch.so not found in assets");
|
||||||
|
}
|
||||||
|
String rawPath = url.getPath();
|
||||||
|
if (rawPath.startsWith("file:")) {
|
||||||
|
soPath = rawPath.substring(5);
|
||||||
|
} else if (rawPath.startsWith("jar:file:")) {
|
||||||
|
soPath = rawPath.substring(9);
|
||||||
|
} else {
|
||||||
|
soPath = rawPath;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
soPath = java.net.URLDecoder.decode(soPath, "UTF-8");
|
||||||
|
} catch (java.io.UnsupportedEncodingException e) {
|
||||||
|
}
|
||||||
|
Log.i(TAG, "Loading native lib from: " + soPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.load(soPath);
|
System.load(soPath);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue