How to get react native code from apk file

No, You cannot retrieve actual code but you can get some decompile code

Installation of apktool:

For Macbook

brew install apktool

For Linux

apt-get install -y apktool

For Windows

you can read installion step for window DOCS

Usage

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 for decompile index.android.bundle file

Decompile index.android.bundle File

you can decompile index.android.bundle by run this command

npx react-native-decompiler -i ./index.android.bundle -o ./output

after that, you will get JS decompiled file in ./output directory


No,I am afraid you cannot retrieve your react native code as if you decompile your apk file it will return you the java code for android but no react native code.

Because,React Native transpile the code into the native language depending upon which OS you want to make a build of either its android or ios.


when you unzip the apk file, inside the assets folder, index.android.bundle file is the bundled react source code. rename index.android.bundle to something.js

since something.js is a bundled file (minified/uglified), use some unuglifier/jsbeautifier to make if readable. (also check jsnice)

it's better than nothing.