18

I downloaded APK file from Google Play, and want to know if the develop of the application have used React Native library. What's a quick and stable way to do that? (Would be even better if it's something I can potentially automate later - but such automation itself is out of scope of this question.)

Max Yankov
  • 12,551
  • 12
  • 67
  • 135

5 Answers5

20

I can offer you 2 solutions:

  • Solution 1

You can use dex2jar. When you open the generated jar file, you can check if it uses React Native if there is a folder /com/facebook/react/.

  • Solution 2

    1. Rename your application APK app.apk into app.zip
    2. Decompress your zip file
    3. Use dexdump from AndroidSDK$ANDROID_HOME/build-tools//dexdump:dexdump classes.dex`
    4. Search for com/facebook/react in the output of dexdump
OlivierM
  • 2,820
  • 24
  • 41
  • 1
    and if the packages names are obfuscated? – David Miguel Apr 06 '18 at 21:39
  • com.facebook.react won't be obfuscated (of proguarded correctly); otherwise it would not be able to be called/initialized. – swooby Apr 18 '18 at 21:43
  • is it possible to decompile react native JS back into JS? – pstanton Jun 17 '18 at 22:51
  • @pstanton What do you mean react native JS back into JS? JavaScript is JavaScript...whether you are using React Naive or not. – kojow7 Jun 20 '18 at 18:22
  • @kojow7 I mean from an apk -> js source .. is that possible? – pstanton Jun 22 '18 at 00:42
  • @pstanton No, you will never be able to get your original looking source files back. If you want further clarification it would be best to ask your own question. – kojow7 Jun 22 '18 at 04:03
  • 3
    @kojow7 there's nothing wrong with comments. feel free not to answer. – pstanton Jun 22 '18 at 06:01
  • 2
    ✅ Tip: Android Studio can "Analyze APK", so you can do that option in the menu or just drag-and-drop the APK to it. Then click on the *.dex file – Sean Apr 28 '19 at 15:09
  • What if it has /com/facebook folder but no /react folder in it ? – Pankaj Jul 15 '19 at 09:11
  • @pstanton a _minified_ version of the JS code resides in `assets/index.android.bundle` (first, decompress the package as described in the answer) – Bogdan D Jul 15 '19 at 13:51
6

The accepted solution certainly will get you the right answer, but it will be quite slow. It is what I did originally, and it was not fast enough for my needs since I was running this script across hundreds of APKs. I developed an alternate solution and executed it before the original made it through 5% of the APKs.

The reason I don't like checking for layouts having com_facebook in the name (the other pre-existing solution) is that it is entirely plausible for an app to be using another Facebook SDK that contains a layout file starting with that string. I don't know of any false positives, but it seemed reasonably likely that there would be some.

Instead I check for the presence of libreactnativejni.so which I have to imagine only gets used if React Native is being used. (I originally was looking for libyoga.so, but I had a few false positives, I think because there's a logging library by the same name.)

Specifically, this condition on a Mac in a bash script is what I'm using (I think it's portable, but have not tested):

if [ "$(unzip -l $apkfile | grep libreactnativejni.so | wc -l)" -gt "0" ]
then 
echo "Uses RN"
fi
jack
  • 573
  • 4
  • 12
  • 1
    The only reason I don't want to change the accepted answer is because I don't have time to personally check it (as I did when I was asking original question and working on a project related to it). – Max Yankov Oct 03 '19 at 10:02
  • What does `libreactnativejni.so` do? Some apps have those `/com/facebook/react/` things but do not have this SO file... – ch271828n Jan 19 '20 at 03:49
  • 1
    The shared object library is what powers a lot of the layout functionality for React Native Android (behind the scenes it actually uses `libyoga.so`, but other apps can include that as well without using RN). The com.facebook.react package has things beyond just RN stuff, though I haven't seen this case myself. Do you have an example app with that property? – jack Jan 20 '20 at 05:46
4

The most simple solution

Open the APK in Android Studio and check the classes.dex-files(can be more the one file). What you are looking for is:

  • React Native - do you find folder com\facebook\react ?
  • Flutter - do you find folder io\flutter ?
  • Xamarin - do you find folder com\xamarin\ ?

It could look like this in Android Studio

Android Studio Apk files

Haroun Hajem
  • 5,223
  • 3
  • 26
  • 39
3

Not sure if this proven way.

Download the apk from the store to your PC, I used APK Downloader FireFox extension (if you don't have the app apk already).

Open apk with Zip software (I am on Linux so I used Ark). Now you can see parts of the project.

Go to res->layout and search for com_facebook..., In my case it was com_facebook_activity_layout.xml. If you have one layout with com_facebook in it then this apk was created with React.

Guy Luz
  • 3,372
  • 20
  • 43
0

i found that the Online APK Analyzer" built by Roman Sisik is helpful online tool to know the frameworks used to build an android app by just uploading the apk file.

I've tested it with flutter and react-native apps and it gave me the correct answer, i also noticed that when no framework is shown it probably means that the app was built natively.

R3-da
  • 231
  • 2
  • 4