'React Native Release App.apk search metro server

I have created a release of my android application. I have used Android Studio to create it, however, when I install the application it closes automatically. The error that appears is the following: enter image description here

The specifications of my first application are as follows (app1):

-react native : 0.68.1
-buildToolsVersion = "31.0.0"
-minSdkVersion = 21
-compileSdkVersion = 31
-targetSdkVersion = 31
-buildGradle : 7.1.3

The same goes for my second app with the following specs (app2):

-react native : 0.67.4
-buildToolsVersion = "30.0.2"
-minSdkVersion = 21
-compileSdkVersion = 30
-targetSdkVersion = 30
-ndkVersion = "21.4.7075529"
-buildGradle : 4.2.2

What I need is a signed apk, I don't need a debug because it compiles. Thank you very much in advance.



Solution 1:[1]

I had the same problem. My solution:

  M1 Macbook Pro
  react-native: "0.68.1",
  buildToolsVersion = "31.0.0"
  minSdkVersion = 21
  compileSdkVersion = 31
  targetSdkVersion = 31
  1. android/app/src/main/assests is not exist. I created one.

  2. npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle

  3. At this stage, the release process results in an error. I am delete all drawable-* folders under android/app/src/main/res. Don't delete android/app/src/main/res/drawable folder!.

  4. in android folder ./gradlew assembleRelease and success!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Baris Bolat