9

I made an app using react native. The app connects to the api that I made. I followed these steps : https://facebook.github.io/react-native/docs/signed-apk-android, and now the app doesn't work if i do react-native run-android --variant=release.The app installs, but I can't login in the app. Is there any way to see if I get any errors or something?

I tried searching for a way to show the debbuging console even if the variant is release, but i can't find any

I want the app the work as the one that is not in release variant.

Darius Biro
  • 169
  • 1
  • 3
  • 12

4 Answers4

31

maybe you need to add android:usesCleartextTraffic="true" inside the application tag in the AndroidManifest.xml .

Something like this:

<application
  ...
  android:usesCleartextTraffic="true"
  ...
>
   ...
</application>
SmoggeR_js
  • 2,950
  • 4
  • 22
  • 52
  • And after i modify this, do I need to do gradlew assembleRelease, or just rerun with run-android --variant=release? I'm not sure how it works... it's my first app – Darius Biro Jul 31 '19 at 12:46
  • just run-android – SmoggeR_js Jul 31 '19 at 12:48
  • 1
    Oh my God.... thank you so much... i've been tring this all day... thank you a lot... Now i have one more question if you could help me. Now that i added this, do i have to do all the steps here or does it save somehow automatically? – Darius Biro Jul 31 '19 at 13:01
  • I'm glad to hear that! About the second question, If you did all that steps you just have to create a new APK by assembleRelease and upload a new version to Google Play. Remember to change the compileVersion and the NameVersion and would be all done – SmoggeR_js Jul 31 '19 at 13:05
  • Modify it in //android/app/src/main/AndroidManifest.xml – George Aug 02 '20 at 17:01
1

I think the issue is because it's an http request.

This might fix your issue: https://stackoverflow.com/a/55834683/6667328

Sanyam Jain
  • 1,154
  • 6
  • 9
0

Please try to be precise or else its difficult to understand the problem.

In order to catch the issues in release mode we have couple of libraries which will help us debug even when the real user is using the app. Check the below two libs they might help you find the issue.

  1. Busgnag
  2. Crashalytics, a module in react-native-firebase
Gokul Kulkarni
  • 2,069
  • 3
  • 26
  • 42
  • I made the app. It works when I run it with react-native run-android. I get no errors or anything. When I try to run it with react-native run-android --variant=release, it installs the app, it launches the app, but when I press the login button just.... nothing hapens... I don't get any errors or anything... it just doesn't redirect me from the Sign in screen to the App screen – Darius Biro Jul 31 '19 at 12:40
0

For me, I saw the same behavior but the reason was very different than the accepted solution. I'll leave my answer here in case it helps someone else.

TL;DR: Make sure your emulator/device has the correct time!

The Problem

If you're using HTTPS, the device and server time need to be in sync or it will not allow a connection.

Normally that's not a problem, but my emulator has been resetting its time for some reason. The result is that when I connected in debug mode the time was right and it connected just fine. However, the time was wrong when I switched to release mode and did NOT connect.

The problem was subtle because my build variants use different servers, so my secure connection in debug was cached and still valid even after the time changed and release mode did not work, which made this look like an issue with build configs.

The Solution

You can very easily find out if this is your same issue by

  1. Checking the time on your device
  2. Opening the URL in a browser. The browser will likely notice the time-difference issue and alert you about it.

If it is, just go into your device settings, update the time, and it should work!