capacitor-dex-editor 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1387,6 +1387,8 @@ public class DexManager {
|
|
|
1387
1387
|
JSObject result = new JSObject();
|
|
1388
1388
|
JSArray results = new JSArray();
|
|
1389
1389
|
|
|
1390
|
+
Log.d(TAG, "searchInDexFromApk: apkPath=" + apkPath + ", dexPath=" + dexPath + ", query=" + query);
|
|
1391
|
+
|
|
1390
1392
|
if (query == null || query.isEmpty()) {
|
|
1391
1393
|
result.put("results", results);
|
|
1392
1394
|
result.put("count", 0);
|
|
@@ -1400,12 +1402,29 @@ public class DexManager {
|
|
|
1400
1402
|
|
|
1401
1403
|
try {
|
|
1402
1404
|
zipFile = new java.util.zip.ZipFile(apkPath);
|
|
1405
|
+
|
|
1406
|
+
// 尝试多种可能的 dexPath 格式
|
|
1403
1407
|
java.util.zip.ZipEntry dexEntry = zipFile.getEntry(dexPath);
|
|
1408
|
+
if (dexEntry == null && !dexPath.startsWith("/")) {
|
|
1409
|
+
// 如果没有找到,尝试去掉开头的斜杠
|
|
1410
|
+
dexEntry = zipFile.getEntry(dexPath.replaceFirst("^/+", ""));
|
|
1411
|
+
}
|
|
1412
|
+
if (dexEntry == null) {
|
|
1413
|
+
// 如果还是没找到,尝试只用文件名
|
|
1414
|
+
String fileName = dexPath;
|
|
1415
|
+
if (dexPath.contains("/")) {
|
|
1416
|
+
fileName = dexPath.substring(dexPath.lastIndexOf("/") + 1);
|
|
1417
|
+
}
|
|
1418
|
+
dexEntry = zipFile.getEntry(fileName);
|
|
1419
|
+
}
|
|
1404
1420
|
|
|
1405
1421
|
if (dexEntry == null) {
|
|
1422
|
+
Log.e(TAG, "DEX file not found in APK: " + dexPath);
|
|
1406
1423
|
throw new IOException("DEX file not found in APK: " + dexPath);
|
|
1407
1424
|
}
|
|
1408
1425
|
|
|
1426
|
+
Log.d(TAG, "Found DEX entry: " + dexEntry.getName());
|
|
1427
|
+
|
|
1409
1428
|
dexInputStream = zipFile.getInputStream(dexEntry);
|
|
1410
1429
|
|
|
1411
1430
|
// 读取 DEX 文件到内存
|