Skip to content

Commit ae8b908

Browse files
JingMatrixNkBe
andauthored
Improve compatibility of native library path resolution (#77)
Replaced rigid substring extraction with a dynamic split by "file:" to handle varying URI schemes (e.g., `file:` vs `jar:file:`) across different devices. Co-authored-by: NkBe <HSSkyBoy@outlook.com>
1 parent 85f9abd commit ae8b908

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

meta-loader/src/main/java/org/lsposed/lspatch/metaloader/LSPAppComponentFactoryStub.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,10 @@ private static void bootstrap() {
9999
transfer(is, os);
100100
dex = os.toByteArray();
101101
}
102-
soPath = cl.getResource("assets/lspatch/so/" + libName + "/liblspatch.so").getPath().substring(5);
102+
String resourcePath = cl.getResource("assets/lspatch/so/" + libName + "/liblspatch.so").getPath();
103+
Log.d(TAG, "Resource path: " + resourcePath);
104+
String[] pathParts = resourcePath.split("file:");
105+
soPath = pathParts[pathParts.length - 1];
103106
}
104107

105108
System.load(soPath);

0 commit comments

Comments
 (0)