capacitor-dex-editor 0.0.22 → 0.0.24

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.
@@ -1738,13 +1738,14 @@ public class DexManager {
1738
1738
 
1739
1739
  zipFile.close();
1740
1740
 
1741
- // 2. MT 风格:使用 ZipInputStream 流式处理替换 DEX
1741
+ // MT 风格:直接替换 APK 内的 DEX
1742
1742
  java.io.File apkFile = new java.io.File(apkPath);
1743
1743
  java.io.File tempApkFile = new java.io.File(apkPath + ".tmp");
1744
1744
  byte[] newDexBytes = readFileBytes(mergedDexFile);
1745
1745
 
1746
- Log.d(TAG, "Replacing DEX in APK (MT style stream)...");
1746
+ Log.d(TAG, "Replacing DEX in APK (MT style)...");
1747
1747
 
1748
+ // 使用 ZipInputStream 流式处理替换 DEX
1748
1749
  java.util.zip.ZipInputStream zis = new java.util.zip.ZipInputStream(
1749
1750
  new java.io.BufferedInputStream(new java.io.FileInputStream(apkFile)));
1750
1751
  java.util.zip.ZipOutputStream zos = new java.util.zip.ZipOutputStream(
@@ -1759,10 +1760,9 @@ public class DexManager {
1759
1760
  zos.putNextEntry(newEntry);
1760
1761
  zos.write(newDexBytes);
1761
1762
  zos.closeEntry();
1762
- // 跳过原 DEX 数据
1763
1763
  zis.closeEntry();
1764
1764
  } else {
1765
- // 直接复制其他条目(流式,不解压到磁盘)
1765
+ // 直接复制其他条目
1766
1766
  java.util.zip.ZipEntry newEntry = new java.util.zip.ZipEntry(entry.getName());
1767
1767
  newEntry.setTime(entry.getTime());
1768
1768
  if (entry.getMethod() == java.util.zip.ZipEntry.STORED) {
@@ -1792,7 +1792,6 @@ public class DexManager {
1792
1792
  Log.e(TAG, "Failed to delete original APK");
1793
1793
  }
1794
1794
  if (!tempApkFile.renameTo(apkFile)) {
1795
- // 如果 rename 失败,尝试复制
1796
1795
  copyFile(tempApkFile, apkFile);
1797
1796
  tempApkFile.delete();
1798
1797
  }
@@ -1800,7 +1799,9 @@ public class DexManager {
1800
1799
  Log.d(TAG, "APK updated successfully: " + apkPath);
1801
1800
 
1802
1801
  result.put("success", true);
1803
- result.put("message", "Smali 保存成功!APK 已更新");
1802
+ result.put("message", "Smali 编译成功!APK 已更新");
1803
+ result.put("apkPath", apkPath);
1804
+ result.put("needSign", true);
1804
1805
 
1805
1806
  // 清理临时文件
1806
1807
  cleanupTempDir(tempDir);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-dex-editor",
3
- "version": "0.0.22",
3
+ "version": "0.0.24",
4
4
  "description": "Capacitor-plugin-for-editing-DEX-files-in-APK",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",