通过 apktool d2j-dex2jar 创建 apk 时出错
errro while creating apk through apktool d2j-dex2jar
重新编译 apktool 生成的代码时出现以下错误:
d2j-dex2jar b base
错误:
java.nio.file.NoSuchFileException: b
at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(Unknown Source)
at java.nio.file.Files.newByteChannel(Unknown Source)
at java.nio.file.Files.newByteChannel(Unknown Source)
at java.nio.file.Files.readAllBytes(Unknown Source)
at com.googlecode.d2j.reader.zip.ZipUtil.readDex(ZipUtil.java:57)
at com.googlecode.d2j.reader.zip.ZipUtil.readDex(ZipUtil.java:53)
at com.googlecode.dex2jar.tools.Dex2jarCmd.doCommandLine(Dex2jarCmd.java
:104)
at com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:288)
at com.googlecode.dex2jar.tools.Dex2jarCmd.main(Dex2jarCmd.java:32)
您使用了错误的标志。因此错误说:我不明白你:'b' 文件不存在。更仔细地阅读帮助。
编辑
d2j-dex2jar --help
d2j-dex2jar -- convert dex to jar
usage: d2j-dex2jar [options] [file1 ... fileN]
options:
-d,--debug-info translate debug info
-e,--exception-file detail exception file, default is
$current_dir/[file-name]-error.zip
-f,--force force overwrite
-h,--help Print this help message
-n,--not-handle-exception not handle any exception throwed by
dex2jar
-o,--output output .jar file, default is
$current_dir/[file-na
me]-dex2jar.jar
-os,--optmize-synchronized optmize-synchronized
-p,--print-ir print ir to Syste.out
-r,--reuse-reg reuse regiter while generate java .class
file
-s same with --topological-sort/-ts
-ts,--topological-sort sort block by topological, that will
generate more
readable code
-v,--verbose show progress
version: reader-1.15, translator-0.0.9.15, ir-1.12
到assemble和反汇编,请阅读手册:
https://sourceforge.net/p/dex2jar/wiki/ModifyApkWithDexTool/
# build jar
d2j-jasmin2jar.sh -f -o test_apk_jasmin.jar test_apk_jasmin/
# verify jar
d2j-asm-verify.sh test_apk_jasmin.jar
# convert to dex
d2j-jar2dex.sh -f -o classes.dex test_apk_jasmin.jar
# make a copy
cp test_apk-debug.apk test_apk-debug-toast.apk
# replace classes.dex in test_apk-debug-toast.apk
zip -r test_apk-debug-toast.apk classes.dex
# sign the apk
d2j-apk-sign.sh -f -o test_apk-debug-toast-signed.apk test_apk-debug-toast.apk
重新编译 apktool 生成的代码时出现以下错误:
d2j-dex2jar b base
错误:
java.nio.file.NoSuchFileException: b at sun.nio.fs.WindowsException.translateToIOException(Unknown Source) at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source) at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source) at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(Unknown Source) at java.nio.file.Files.newByteChannel(Unknown Source) at java.nio.file.Files.newByteChannel(Unknown Source) at java.nio.file.Files.readAllBytes(Unknown Source) at com.googlecode.d2j.reader.zip.ZipUtil.readDex(ZipUtil.java:57) at com.googlecode.d2j.reader.zip.ZipUtil.readDex(ZipUtil.java:53) at com.googlecode.dex2jar.tools.Dex2jarCmd.doCommandLine(Dex2jarCmd.java :104) at com.googlecode.dex2jar.tools.BaseCmd.doMain(BaseCmd.java:288) at com.googlecode.dex2jar.tools.Dex2jarCmd.main(Dex2jarCmd.java:32)
您使用了错误的标志。因此错误说:我不明白你:'b' 文件不存在。更仔细地阅读帮助。
编辑
d2j-dex2jar --help
d2j-dex2jar -- convert dex to jar
usage: d2j-dex2jar [options] [file1 ... fileN]
options:
-d,--debug-info translate debug info
-e,--exception-file detail exception file, default is $current_dir/[file-name]-error.zip
-f,--force force overwrite
-h,--help Print this help message
-n,--not-handle-exception not handle any exception throwed by dex2jar
-o,--output output .jar file, default is $current_dir/[file-na me]-dex2jar.jar
-os,--optmize-synchronized optmize-synchronized
-p,--print-ir print ir to Syste.out
-r,--reuse-reg reuse regiter while generate java .class file
-s same with --topological-sort/-ts
-ts,--topological-sort sort block by topological, that will generate more readable code
-v,--verbose show progress
version: reader-1.15, translator-0.0.9.15, ir-1.12
到assemble和反汇编,请阅读手册:
https://sourceforge.net/p/dex2jar/wiki/ModifyApkWithDexTool/
# build jar
d2j-jasmin2jar.sh -f -o test_apk_jasmin.jar test_apk_jasmin/
# verify jar
d2j-asm-verify.sh test_apk_jasmin.jar
# convert to dex
d2j-jar2dex.sh -f -o classes.dex test_apk_jasmin.jar
# make a copy
cp test_apk-debug.apk test_apk-debug-toast.apk
# replace classes.dex in test_apk-debug-toast.apk
zip -r test_apk-debug-toast.apk classes.dex
# sign the apk
d2j-apk-sign.sh -f -o test_apk-debug-toast-signed.apk test_apk-debug-toast.apk