title: clean react native project immediately crashes on real android device debug mode
body: <p>I have a strange problem with React Native. I have checked it with several versions of RN for example 0.55.0 to 0.61.2 and tried several solutions but none of them solved my problem.
  The problem is when I install debug apk on my real device(samsung s7 edge - android 8.0.0), when the bundle load, app immediately crashes. But if I install signed release apk, it works fine. It is so wired.</p>
  
  <p>For example I did:</p>
  
  <pre><code>react-native init AwesomeProject
  cd AwesomeProject
  react-native run-android
  </code></pre>
  
  <p>Then app crashed immediately, Though it works properly on emulator.</p>
  
  <p>here is logcat logs:</p>
  
  <pre><code>10-23 00:39:14.840: D/StorageManagerService(3655): getExternalStorageMountMode : final mountMode=1, uid : 10821, packageName : com.awesomeproject
  10-23 00:39:14.840: I/ApplicationPolicy(3655): isApplicationExternalStorageWhitelisted:com.awesomeproject user:0
  10-23 00:39:14.840: D/ActivityManager(3655): package  com.awesomeproject, user - 0 is SDcard whitelisted
  10-23 00:39:14.840: I/ApplicationPolicy(3655): isApplicationExternalStorageBlacklisted:com.awesomeproject user:0
  10-23 00:39:14.870: I/ActivityManager(3655): Start proc 22662:com.awesomeproject/u0a821 for activity com.awesomeproject/.MainActivity
  10-23 00:39:14.877: I/SELinux(22662): SELinux: seapp_context_lookup: seinfo=untrusted, level=s0:c512,c768, pkgname=com.awesomeproject 
  10-23 00:39:14.953: I/ActivityManager(3655): START u0 {act=android.intent.action.MAIN typ=null flg=0x10200000 cmp=ComponentInfo{com.awesomeproject/com.awesomeproject.MainActivity}} from uid 10068
  10-23 00:39:14.956: D/ActivityManagerPerformance(3655): Received MSG_CFMS_HINT_AMS_SWITCH pkgName: com.awesomeproject
  10-23 00:39:14.967: D/ViewRootImpl@1d7ab40[awesomeproject](3655): setView = DecorView@d5d3be[awesomeproject] TM=true MM=false
  10-23 00:39:14.967: D/ViewRootImpl@1d7ab40[awesomeproject](3655): setView = DecorView@d5d3be[awesomeproject] TM=true MM=false
  10-23 00:39:14.971: I/ActivityManager(3655): DSS on for com.awesomeproject and scale is 1.0
  10-23 00:39:14.973: V/WindowManager(3655): Relayout Window{2819a79 u0 Splash Screen com.awesomeproject}: viewVisibility=0 req=1080x1848 WM.LayoutParams{(0,0)(fillxfill) sim=#20 ty=3 fl=#81830118 pfl=0x20011 wanim=0x10302fd vsysui=0x600 needsMenuKey=2 colorMode=0 naviIconColor=0}
  10-23 00:39:14.975: I/SurfaceFlinger(3197): id=592 createSurf (1080x1920),1 flag=404, Splash Screen com.awesomeproject#0
  10-23 00:39:15.001: V/WindowManager(3655): finishDrawingLocked: mDrawState=COMMIT_DRAW_PENDING Window{2819a79 u0 Splash Screen com.awesomeproject} in Surface(name=Splash Screen com.awesomeproject)
  10-23 00:39:15.002: D/ActivityManager(3655): applyOptionsLocked, ANIM_CUSTOM_SCALE_UP, task.getRootActivity() : ActivityRecord{6b7a94b u0 com.awesomeproject/.MainActivity t9606}, task.getTaskToReturnTo() : 1
  10-23 00:39:15.010: D/GameManagerService(3655): handleForegroundChange(). pkgName: com.awesomeproject, clsName: com.awesomeproject.MainActivity,FgActivityName:com.awesomeproject/.MainActivity
  10-23 00:39:15.011: D/GameManagerService(3655): notifyResumePause(). pkg: com.awesomeproject, type: 4, isMinimized: false, isTunableApp: false
  10-23 00:39:15.011: D/MARsPolicyManager(3655): onPackageResumedFG pkgName = com.awesomeproject, userId = 0
  10-23 00:39:15.029: D/GamePkgDataHelper(3655): getGamePkgDataIncServer(). com.awesomeproject
  10-23 00:39:15.029: D/GamePkgDataHelper(3655): getGamePkgDataIncServer(). com.awesomeproject
  10-23 00:39:15.030: D/GameManagerService(3655): identifyGamePackage. com.awesomeproject
  10-23 00:39:15.030: D/GamePkgDataHelper(3655): getGamePkgData(). com.awesomeproject
  10-23 00:39:15.036: D/GamePkgDataHelper(3655): getGamePkgData(). com.awesomeproject
  10-23 00:39:15.037: D/GameManagerService(3655): identifyGamePackage. com.awesomeproject
  10-23 00:39:15.037: D/GamePkgDataHelper(3655): getGamePkgData(). com.awesomeproject
  10-23 00:39:15.045: D/SoLoader(22662): adding application source: com.facebook.soloader.DirectorySoSource[root = /data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/lib/arm64 flags = 0]
  10-23 00:39:15.046: D/SoLoader(22662): adding backup source from : com.facebook.soloader.ApkSoSource[root = /data/data/com.awesomeproject/lib-main flags = 1]
  10-23 00:39:15.047: D/SoLoader(22662): Preparing SO source: com.facebook.soloader.DirectorySoSource[root = /data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/lib/arm64 flags = 0]
  10-23 00:39:15.047: D/SoLoader(22662): Preparing SO source: com.facebook.soloader.ApkSoSource[root = /data/data/com.awesomeproject/lib-main flags = 1]
  10-23 00:39:15.048: V/fb-UnpackingSoSource(22662): locked dso store /data/user/0/com.awesomeproject/lib-main
  10-23 00:39:15.050: I/fb-UnpackingSoSource(22662): dso store is up-to-date: /data/user/0/com.awesomeproject/lib-main
  10-23 00:39:15.050: V/fb-UnpackingSoSource(22662): releasing dso store lock for /data/user/0/com.awesomeproject/lib-main
  10-23 00:39:15.052: W/System.err(22662):    at com.awesomeproject.MainApplication.initializeFlipper(MainApplication.java:61)
  10-23 00:39:15.052: W/System.err(22662):    at com.awesomeproject.MainApplication.onCreate(MainApplication.java:46)
  10-23 00:39:15.053: W/System.err(22662): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.flipper.ReactNativeFlipper" on path: DexPathList[[zip file "/data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/base.apk"],nativeLibraryDirectories=[/data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/lib/arm64, /data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]
  10-23 00:39:15.056: D/GameManagerService(3655): identifyGamePackage. com.awesomeproject
  10-23 00:39:15.056: D/GamePkgDataHelper(3655): getGamePkgData(). com.awesomeproject
  10-23 00:39:15.061: D/GameManagerService(3655): identifyGamePackage. com.awesomeproject
  10-23 00:39:15.061: D/GamePkgDataHelper(3655): getGamePkgData(). com.awesomeproject
  10-23 00:39:15.061: D/SurfaceFlinger(3197):        HWC | 7df8a2dcc0 | 0000 | 0020 | 00 | 0105 | RGBA_8888   |    0.0,    0.0, 1080.0, 1920.0 |  112,  129,  828, 1402 | Splash Screen com.awesomeproject#0
  10-23 00:39:15.090: D/SoLoader(22662): libjscexecutor.so not found on /data/data/com.awesomeproject/lib-main
  10-23 00:39:15.090: D/SoLoader(22662): libjscexecutor.so found on /data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/lib/arm64
  10-23 00:39:15.140: D/SurfaceFlinger(3197):       GLES | 7df8a2dcc0 | 0000 | 0020 | 00 | 0105 | RGBA_8888   |    0.0,    0.0, 1080.0, 1920.0 |   27,   31, 1020, 1796 | Splash Screen com.awesomeproject#0
  10-23 00:39:15.160: D/MdnieScenarioControlService(3655):  packageName : com.awesomeproject    className : com.awesomeproject.MainActivity
  10-23 00:39:15.178: I/zygote64(22662): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList[[zip file "/data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/base.apk"],nativeLibraryDirectories=[/data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/lib/arm64, /data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]
  10-23 00:39:15.179: I/zygote64(22662): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList[[zip file "/data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/base.apk"],nativeLibraryDirectories=[/data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/lib/arm64, /data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]
  10-23 00:39:15.179: I/zygote64(22662): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList[[zip file "/data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/base.apk"],nativeLibraryDirectories=[/data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/lib/arm64, /data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]
  10-23 00:39:15.226: V/WindowManager(3655): Relayout Window{acc6470 u0 com.awesomeproject/com.awesomeproject.MainActivity}: viewVisibility=0 req=1080x1848 WM.LayoutParams{(0,0)(fillxfill) sim=#110 ty=1 fl=#81810100 pfl=0x20000 wanim=0x10302fd vsysui=0x600 needsMenuKey=2 colorMode=0 naviIconColor=0}
  10-23 00:39:15.228: I/SurfaceFlinger(3197): id=593 createSurf (1080x1920),1 flag=404, com.awesomeproject/com.awesomeproject.MainActivity#0
  10-23 00:39:15.242: D/libGLESv1(22662): STS_GLApi : DTS, ODTC are not allowed for Package : com.awesomeproject
  10-23 00:39:15.261: V/InputMethodManager(22662): Starting input: tba=android.view.inputmethod.EditorInfo@3926903 nm : com.awesomeproject ic=null
  10-23 00:39:15.262: V/InputMethodManagerService(3655): windowGainedFocus : reason=WINDOW_FOCUS_GAIN client=android.os.BinderProxy@927ec22 inputContext=null missingMethods= attribute=android.view.inputmethod.EditorInfo@e6b579c nm = com.awesomeproject controlFlags=#104 softInputMode=#110 windowFlags=#81810100
  10-23 00:39:15.288: V/WindowManager(3655): finishDrawingLocked: mDrawState=COMMIT_DRAW_PENDING Window{acc6470 u0 com.awesomeproject/com.awesomeproject.MainActivity} in Surface(name=com.awesomeproject/com.awesomeproject.MainActivity)
  10-23 00:39:15.293: D/InputEventReceiver(3655): channel '2819a79 Splash Screen com.awesomeproject (client)' ~ Disposing input event receiver.
  10-23 00:39:15.293: D/InputEventReceiver(3655): channel '2819a79 Splash Screen com.awesomeproject (client)' ~NativeInputEventReceiver.
  10-23 00:39:15.309: D/SurfaceFlinger(3197):        HWC | 7df8a2dcc0 | 0000 | 0020 | 00 | 0100 | RGBA_8888   |    0.0,    0.0, 1080.0, 1920.0 |    0,    0, 1080, 1920 | Splash Screen com.awesomeproject#0
  10-23 00:39:15.318: V/InputMethodManager(22662): Starting input: tba=android.view.inputmethod.EditorInfo@ca7d080 nm : com.awesomeproject ic=null
  10-23 00:39:15.325: D/SurfaceFlinger(3197):        HWC | 7df47fddc0 | 0000 | 0020 | 00 | 0100 | RGBA_8888   |    0.0,    0.0, 1080.0, 1920.0 |    0,    0, 1080, 1920 | com.awesomeproject/com.awesomeproject.MainActivity#0
  10-23 00:39:15.325: I/WindowManager(3655): Destroying surface Surface(name=Splash Screen com.awesomeproject) called by com.android.server.wm.WindowStateAnimator.destroySurface:2501 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:985 com.android.server.wm.WindowState.destroyOrSaveSurfaceUnchecked:3680 com.android.server.wm.WindowState.destroySurface:3628 com.android.server.wm.AppWindowToken.destroySurfaces:722 com.android.server.wm.AppWindowToken.destroySurfaces:706 com.android.server.wm.WindowState.onExitAnimationDone:5335 com.android.server.wm.WindowStateAnimator.stepAnimationLocked:550 
  10-23 00:39:15.325: I/SurfaceFlinger(3197): id=592 Removed Splash Screen com.awesomeproject#0 (4/7)
  10-23 00:39:15.331: I/SurfaceFlinger(3197): id=592 Removed Splash Screen com.awesomeproject#0 (-2/7)
  10-23 00:39:15.337: I/Layer(3197): id=592 onRemoved Splash Screen com.awesomeproject#0 
  10-23 00:39:15.345: I/ActivityManager(3655): Displayed com.awesomeproject/.MainActivity: +361ms
  10-23 00:39:15.355: D/SurfaceFlinger(3197):        HWC | 7df47fddc0 | 0000 | 0020 | 00 | 0100 | RGBA_8888   |    0.0,    0.0, 1080.0, 1920.0 |    0,    0, 1080, 1920 | com.awesomeproject/com.awesomeproject.MainActivity#0
  10-23 00:39:15.440: D/SurfaceFlinger(3197):        HWC | 7df47fddc0 | 0000 | 0020 | 00 | 0100 | RGBA_8888   |    0.0,    0.0, 1080.0, 1920.0 |    0,    0, 1080, 1920 | com.awesomeproject/com.awesomeproject.MainActivity#0
  10-23 00:39:15.440: D/SoLoader(22662): libreactnativejni.so not found on /data/data/com.awesomeproject/lib-main
  10-23 00:39:15.440: D/SoLoader(22662): libreactnativejni.so found on /data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/lib/arm64
  10-23 00:39:15.443: D/SoLoader(22662): libfb.so not found on /data/data/com.awesomeproject/lib-main
  10-23 00:39:15.443: D/SoLoader(22662): libfb.so found on /data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/lib/arm64
  10-23 00:39:15.444: D/SoLoader(22662): libfb.so not found on /data/data/com.awesomeproject/lib-main
  10-23 00:39:15.444: D/SoLoader(22662): libfb.so found on /data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/lib/arm64
  10-23 00:39:15.444: I/zygote64(22662): Thread[24,tid=22718,Native,Thread*=0x7cfc286e00,peer=0x12fd5a20,"create_react_context"] recursive attempt to load library "/data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/lib/arm64/libfb.so"
  10-23 00:39:15.489: D/MdnieScenarioControlService(3655):  packageName : com.awesomeproject    className : com.awesomeproject.MainActivity
  10-23 00:39:15.629: D/SoLoader(22662): libyoga.so not found on /data/data/com.awesomeproject/lib-main
  10-23 00:39:15.630: D/SoLoader(22662): libyoga.so found on /data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/lib/arm64
  10-23 00:39:16.055: A/DEBUG(22734): pid: 22662, tid: 22721, name: mqt_native_modu  &gt;&gt;&gt; com.awesomeproject &lt;&lt;&lt;
  10-23 00:39:17.162: W/ActivityManager(3655): crash : com.awesomeproject,0
  10-23 00:39:17.163: W/ActivityManager(3655):   Force finishing activity com.awesomeproject/.MainActivity
  10-23 00:39:17.165: W/MultiScreenManagerService(3655): moveTaskBackToDisplayIfNeeded(): root activity or app is null, task=TaskRecord{9d01df6d0 #9606 A=com.awesomeproject U=0 StackId=1 sz=1}, rootActivity=null
  10-23 00:39:17.173: I/ActivityManager(3655): Showing crash dialog for package com.awesomeproject u0
  10-23 00:39:17.222: D/ViewRootImpl@21c7092[awesomeproject](3655): setView = DecorView@f14f719[awesomeproject] TM=true MM=false
  10-23 00:39:17.241: V/WindowManager(3655): Relayout Window{da21660 u0 Application Error: com.awesomeproject}: viewVisibility=0 req=1015x442 WM.LayoutParams{(0,0)(wrapxwrap) gr=#11 sim=#120 ty=2003 fl=#1820002 pfl=0x110 fmt=-3 wanim=0x10302ec surfaceInsets=Rect(6, 6 - 6, 6) needsMenuKey=2 colorMode=0 naviIconColor=0}
  10-23 00:39:17.244: I/SurfaceFlinger(3197): id=595 createSurf (1027x454),1 flag=4, Application Error: com.awesomeproject#0
  10-23 00:39:17.273: I/WindowManager(3655): WIN DEATH: Window{acc6470 u0 com.awesomeproject/com.awesomeproject.MainActivity}
  10-23 00:39:17.274: I/WindowManager(3655): Destroying surface Surface(name=com.awesomeproject/com.awesomeproject.MainActivity) called by com.android.server.wm.WindowStateAnimator.destroySurface:2501 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:985 com.android.server.wm.WindowState.removeImmediately:2404 com.android.server.wm.WindowState.removeIfPossible:2606 com.android.server.wm.WindowState.-wrap1:0 com.android.server.wm.WindowState$DeathRecipient.binderDied:3151 android.os.BinderProxy.sendDeathNotice:843 &lt;bottom of call stack&gt; 
  10-23 00:39:17.278: I/SurfaceFlinger(3197): id=593 Removed com.awesomeproject/com.awesomeproject.MainActivity#0 (1/6)
  10-23 00:39:17.278: I/SurfaceFlinger(3197): id=593 Removed com.awesomeproject/com.awesomeproject.MainActivity#0 (-2/6)
  10-23 00:39:17.282: I/ActivityManager(3655): Process com.awesomeproject (pid 22662) has died: vis  +99TOP (133,1567)
  10-23 00:39:17.285: V/WindowManager(3655): finishDrawingLocked: mDrawState=COMMIT_DRAW_PENDING Window{da21660 u0 Application Error: com.awesomeproject} in Surface(name=Application Error: com.awesomeproject)
  10-23 00:39:17.286: I/SurfaceFlinger(3197): id=593 Removed com.awesomeproject/com.awesomeproject.MainActivity#0 (-2/6)
  10-23 00:39:17.289: I/Layer(3197): id=593 onRemoved com.awesomeproject/com.awesomeproject.MainActivity#0 
  10-23 00:39:17.326: D/SurfaceFlinger(3197):       GLES | 7df0377180 | 0000 | 0000 | 00 | 0105 | RGBA_8888   |    0.0,    0.0, 1027.0,  454.0 |   68,  787, 1010, 1204 | Application Error: com.awesomeproject#0
  10-23 00:39:17.334: D/PackageManager(3655): getComponentMetadataForIconTray : com.awesomeproject.MainActivity does not exist in mServices
  10-23 00:39:17.334: D/PackageManager(3655): getComponentMetadataForIconTray : com.awesomeproject.MainActivity does not exist in mProviders
  10-23 00:39:17.334: D/PackageManager(3655): getComponentMetadataForIconTray : com.awesomeproject.MainActivity does not exist in mReceivers
  10-23 00:39:17.335: D/ApplicationPackageManager(4073): updateItemMetaDataForFixedIconScale: package: com.awesomeproject
  10-23 00:39:17.335: D/PackageManager(3655): getSelectedMetaData : packageName(com.awesomeproject) or Metadata strings {[Ljava.lang.String;@a4708a8}
  10-23 00:39:17.336: I/ApplicationPackageManager(4073): load=com.awesomeproject, bg=144-144, dr=144-144, forDefault=true, density=0
  10-23 00:39:17.338: I/ApplicationPackageManager(4073): load=com.awesomeproject-crop, bg=114-114, dr=144-144
  10-23 00:39:17.341: W/PkgUtils(17655): p: com.awesomeproject, u:0
  10-23 00:39:17.358: D/SurfaceFlinger(3197):       GLES | 7df0377180 | 0000 | 0000 | 00 | 0105 | RGBA_8888   |    0.0,    0.0, 1027.0,  454.0 |   48,  778, 1031, 1213 | Application Error: com.awesomeproject#0
  10-23 00:39:17.452: D/SurfaceFlinger(3197):    22,  767, 1058, 1225 | Application Error: com.awesomeproject#0
  10-23 00:39:17.460: D/SurfaceFlinger(3197):        HWC | 7df0377180 | 0000 | 0000 | 00 | 0105 | RGBA_8888   |    0.0,    0.0, 1027.0,  454.0 |   20,  767, 1058, 1226 | Application Error: com.awesomeproject#0
  10-23 00:39:21.455: D/SurfaceFlinger(3197): 5 | RGBA_8888   |    0.0,    0.0, 1027.0,  454.0 |   26,  769, 1053, 1223 | Application Error: com.awesomeproject#0
  
  </code></pre>
  
  <p>here is my package.json:</p>
  
  <pre><code>{
    "name": "AwesomeProject",
    "version": "0.0.1",
    "private": true,
    "scripts": {
      "android": "react-native run-android",
      "ios": "react-native run-ios",
      "start": "react-native start",
      "test": "jest",
      "lint": "eslint ."
    },
    "dependencies": {
      "react": "16.9.0",
      "react-native": "0.61.2"
    },
    "devDependencies": {
      "@babel/core": "^7.6.4",
      "@babel/runtime": "^7.6.3",
      "@react-native-community/eslint-config": "^0.0.5",
      "babel-jest": "^24.9.0",
      "eslint": "^6.5.1",
      "jest": "^24.9.0",
      "metro-react-native-babel-preset": "^0.56.0",
      "react-test-renderer": "16.9.0"
    },
    "jest": {
      "preset": "react-native"
    }
  }
  
  </code></pre>
  
  <p>build.gradle:</p>
  
  <pre><code>buildscript {
      ext {
          buildToolsVersion = "28.0.3"
          minSdkVersion = 16
          compileSdkVersion = 28
          targetSdkVersion = 28
      }
      repositories {
          google()
          jcenter()
      }
      dependencies {
          classpath("com.android.tools.build:gradle:3.4.2")
  
          // NOTE: Do not place your application dependencies here; they belong
          // in the individual module build.gradle files
      }
  }
  
  allprojects {
      repositories {
          mavenLocal()
          maven {
              // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
              url("$rootDir/../node_modules/react-native/android")
          }
          maven {
              // Android JSC is installed from npm
              url("$rootDir/../node_modules/jsc-android/dist")
          }
  
          google()
          jcenter()
          maven { url 'https://jitpack.io' }
      }
  }
  
  </code></pre>
  
  <pre><code>apply plugin: "com.android.application"
  
  import com.android.build.OutputFile
  
  /**
   * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
   * and bundleReleaseJsAndAssets).
   * These basically call `react-native bundle` with the correct arguments during the Android build
   * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
   * bundle directly from the development server. Below you can see all the possible configurations
   * and their defaults. If you decide to add a configuration block, make sure to add it before the
   * `apply from: "../../node_modules/react-native/react.gradle"` line.
   *
   * project.ext.react = [
   *   // the name of the generated asset file containing your JS bundle
   *   bundleAssetName: "index.android.bundle",
   *
   *   // the entry file for bundle generation
   *   entryFile: "index.android.js",
   *
   *   // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
   *   bundleCommand: "ram-bundle",
   *
   *   // whether to bundle JS and assets in debug mode
   *   bundleInDebug: false,
   *
   *   // whether to bundle JS and assets in release mode
   *   bundleInRelease: true,
   *
   *   // whether to bundle JS and assets in another build variant (if configured).
   *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
   *   // The configuration property can be in the following formats
   *   //         'bundleIn${productFlavor}${buildType}'
   *   //         'bundleIn${buildType}'
   *   // bundleInFreeDebug: true,
   *   // bundleInPaidRelease: true,
   *   // bundleInBeta: true,
   *
   *   // whether to disable dev mode in custom build variants (by default only disabled in release)
   *   // for example: to disable dev mode in the staging build type (if configured)
   *   devDisabledInStaging: true,
   *   // The configuration property can be in the following formats
   *   //         'devDisabledIn${productFlavor}${buildType}'
   *   //         'devDisabledIn${buildType}'
   *
   *   // the root of your project, i.e. where "package.json" lives
   *   root: "../../",
   *
   *   // where to put the JS bundle asset in debug mode
   *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
   *
   *   // where to put the JS bundle asset in release mode
   *   jsBundleDirRelease: "$buildDir/intermediates/assets/release",
   *
   *   // where to put drawable resources / React Native assets, e.g. the ones you use via
   *   // require('./image.png')), in debug mode
   *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
   *
   *   // where to put drawable resources / React Native assets, e.g. the ones you use via
   *   // require('./image.png')), in release mode
   *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
   *
   *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means
   *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
   *   // date; if you have any other folders that you want to ignore for performance reasons (gradle
   *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
   *   // for example, you might want to remove it from here.
   *   inputExcludes: ["android/**", "ios/**"],
   *
   *   // override which node gets called and with what additional arguments
   *   nodeExecutableAndArgs: ["node"],
   *
   *   // supply additional arguments to the packager
   *   extraPackagerArgs: []
   * ]
   */
  
  project.ext.react = [
      entryFile: "index.js",
      enableHermes: false,  // clean and rebuild if changing
  ]
  
  apply from: "../../node_modules/react-native/react.gradle"
  
  /**
   * Set this to true to create two separate APKs instead of one:
   *   - An APK that only works on ARM devices
   *   - An APK that only works on x86 devices
   * The advantage is the size of the APK is reduced by about 4MB.
   * Upload all the APKs to the Play Store and people will download
   * the correct one based on the CPU architecture of their device.
   */
  def enableSeparateBuildPerCPUArchitecture = false
  
  /**
   * Run Proguard to shrink the Java bytecode in release builds.
   */
  def enableProguardInReleaseBuilds = false
  
  /**
   * The preferred build flavor of JavaScriptCore.
   *
   * For example, to use the international variant, you can use:
   * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
   *
   * The international variant includes ICU i18n library and necessary data
   * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
   * give correct results when using with locales other than en-US.  Note that
   * this variant is about 6MiB larger per architecture than default.
   */
  def jscFlavor = 'org.webkit:android-jsc:+'
  
  /**
   * Whether to enable the Hermes VM.
   *
   * This should be set on project.ext.react and mirrored here.  If it is not set
   * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
   * and the benefits of using Hermes will therefore be sharply reduced.
   */
  def enableHermes = project.ext.react.get("enableHermes", false);
  
  android {
      compileSdkVersion rootProject.ext.compileSdkVersion
  
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_8
          targetCompatibility JavaVersion.VERSION_1_8
      }
  
      defaultConfig {
          applicationId "com.awesomeproject"
          minSdkVersion rootProject.ext.minSdkVersion
          targetSdkVersion rootProject.ext.targetSdkVersion
          versionCode 1
          versionName "1.0"
      }
      splits {
          abi {
              reset()
              enable enableSeparateBuildPerCPUArchitecture
              universalApk false  // If true, also generate a universal APK
              include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
          }
      }
      signingConfigs {
          debug {
              storeFile file('debug.keystore')
              storePassword 'android'
              keyAlias 'androiddebugkey'
              keyPassword 'android'
          }
      }
      buildTypes {
          debug {
              signingConfig signingConfigs.debug
          }
          release {
              // Caution! In production, you need to generate your own keystore file.
              // see https://facebook.github.io/react-native/docs/signed-apk-android.
              signingConfig signingConfigs.debug
              minifyEnabled enableProguardInReleaseBuilds
              proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
          }
      }
      // applicationVariants are e.g. debug, release
      applicationVariants.all { variant -&gt;
          variant.outputs.each { output -&gt;
              // For each separate APK per architecture, set a unique version code as described here:
              // https://developer.android.com/studio/build/configure-apk-splits.html
              def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
              def abi = output.getFilter(OutputFile.ABI)
              if (abi != null) {  // null for the universal-debug, universal-release variants
                  output.versionCodeOverride =
                          versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
              }
  
          }
      }
  }
  
  dependencies {
      implementation fileTree(dir: "libs", include: ["*.jar"])
      implementation "com.facebook.react:react-native:+"  // From node_modules
  
      if (enableHermes) {
          def hermesPath = "../../node_modules/hermes-engine/android/";
          debugImplementation files(hermesPath + "hermes-debug.aar")
          releaseImplementation files(hermesPath + "hermes-release.aar")
      } else {
          implementation jscFlavor
      }
  }
  
  // Run this once to be able to run the application with BUCK
  // puts all compile dependencies into folder libs for BUCK to use
  task copyDownloadableDepsToLibs(type: Copy) {
      from configurations.compile
      into 'libs'
  }
  
  apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
  
  </code></pre>