Search code examples
javaandroiddecompilingapktool

errro while creating apk through apktool d2j-dex2jar


Getting following error while recompiling apktool generated code:

d2j-dex2jar b base

Error:

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)


Solution

  • You use incorrect flag. Thus error says: i do not understand you : 'b' file doesn't exist. Read help more carefully.

    EDIT

    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

    to assemble and disassmble , please, read manual:

    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