I wrote one app in react native, but accidentally near the end of development, my HDD crashes and right now I have only APK file, can I retrieve react native code back just from that apk file?
When you open the generated jar file, you can check if it uses React Native if there is a folder /com/facebook/react/ .
No, You cannot retrieve actual code but you can get some decompile code
brew install apktool
apt-get install -y apktool
you can read installion step for window 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 for decompile index.android.bundle
file
index.android.bundle
Fileyou 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
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With