代码之家  ›  专栏  ›  技术社区  ›  ristapk

如何从apk文件中获取react本机代码

  •  0
  • ristapk  · 技术社区  · 7 年前

    1 回复  |  直到 7 年前
        1
  •  34
  •   GnoStiC    7 年前

    解压apk文件时,assets文件夹中的index.android.bundle文件是绑定的react源代码。将index.android.bundle重命名为something.js

    总比什么都没有强。

        2
  •  8
  •   Saad Maqbool    7 年前

    因为,React Native可以将代码转换为本机语言,具体取决于您要构建的操作系统是android还是ios。

        3
  •  0
  •   Muhammad Numan    5 年前

    对于Macbook

    brew install apktool
    

    对于Linux

    apt-get install -y apktool
    

    对于窗口

    您可以阅读窗口的安装步骤 DOCS

    after install `apktool`, unzip apk file by run this command on terminal like this:
    
    

    apktool d/pathOfApkFile.apk文件

    
    After that you will get `index.android.bundle` file at `pathOfApkFile/assets/index.android.bundle`
    
    than you can use [react-native-decompiler][1] for decompile `index.android.bundle` file
    
    ## Decompile `index.android.bundle` File
    you can decompile `index.android.bundle` by run this command
    

    npx react本机反编译器-i./index.android.bundle-o./output

    after that, you will get **JS decompiled file** in `./output` directory
    
      [1]: https://www.npmjs.com/package/react-native-decompiler