DEV Community

Engin ERGEN
Engin ERGEN

Posted on

React Native Application Freezes/Crashes Samsung Galaxy S24 Devices

What Is The Problem?

Nowadays many developers talk about a problem. On Samsung Galaxy S24(Plus, Ultra) Their application does not work at all. It freezes on Splash Screen and nothing happens. The problem is not appearing on debug mode but only after Google Play release. The users installs application from Google Play then they encounter this problem. Unfortunately, they can’t use the application.

I researched about this problem. Even I tried in my Android Studio native application. I couldn’t detech the problem. The problem appears only in React Native and I also got this problem in React Native.

In this blog, We will take this problem as a topic.

Reasons

Firstly, We need to understand why it happens only Samsung Galaxy S24 devices. Well, actually, We do not know kind of devices have this problem. Maybe more device might be having this problem but If we create a solution for Samsung Galaxy 24, I think We will fix it for other devices.

This is an example for the problem about how it is appearing when you tried to open the application.

Image description

Emulators, physicals many of them supports 32Bit codes but Samsung Galaxy S24 is a 64Bit device which does not support 32Bit anymore.

The first reason could be this: Your React Native application contains 32-bit codes, which cause issues only on devices that support 64-bit.

So why is it running on Debug Mode?

You might ask this question, but applications have different roles and configurations in debug and release modes. Due to these configurations, it may appear to work fine in debug mode. This should never mislead you.

The second reason for the error could be version incompatibility between React Native and other dependent libraries. It will be necessary to identify these issues and it is important to check the versions of the libraries you are using.

As new model devices hit the market, they come with incredible changes. In this context, it is important for developers to be prepared for all kinds of situations.

Solutions

Now it is time to address the solutions.

For our first solution method, we will refer to the official sources listed below.

Support 64-bit architectures | Android Developers

Those who are interested can read the source above to gain more detailed information.

First Solution

Firstly, we need to learn about the SoLoader library. SoLoader is an Android library developed by Facebook. Its role is to load libraries into the application and ensure their dynamic availability.

The main source of the error might be this library. An article in the official source I provided above seems to confirm this.

SoLoader v0.9.0 and lower assume that system libraries are present in /vendor/lib:/system/lib. This bug is not observable in devices like the Pixel 7 where the path exists, but this assumption causes crashes in devices that only have system libraries in /vendor/lib64:/system/lib64.

This is exactly what is happening to us. Our application is getting stuck and not progressing due to 64-bit issues at startup.

My guess is that this is the main reason for the application crashing and freezing on the Splash Screen on many devices. I believe that by applying the following solutions, you will not encounter this problem.

Note: Since the application will always work in debug mode, you need to test it on Google Play.

Actually, the solution of this problem is provided right before this answer.

If you are using the native code loader SDK SoLoader, update to v0.10.4 or higher. If your app uses SDKs that depend on SoLoader, make sure to also update to the latest stable version of the affected SDKs

As explained, we will apply the provided solution and upgrade the SoLoader version to v0.10.4.



Open android/build.gradle


Enter fullscreen mode Exit fullscreen mode

Find the following lines below.



ext {
  buildToolsVersion = "xxx"
  minSdkVersion = xx
  compileSdkVersion = xx
  targetSdkVersion = xx
}


Enter fullscreen mode Exit fullscreen mode

Add the line soLoaderVersion = '0.10.4+' into this object. The final version should look like this:



ext {
  buildToolsVersion = "xxx" // Do not change this part. Do it if necessary.
  minSdkVersion = xx // Do not change this part. Do it if necessary.
  compileSdkVersion = xx // Do not change this part. Do it if necessary.
  targetSdkVersion = xx // Do not change this part. Do it if necessary.
  soLoaderVersion = "0.10.4+"
}


Enter fullscreen mode Exit fullscreen mode

Now we are going to use the parameter we added. To do this, open the app-level build.gradle file below.



android/app/build.gradle


Enter fullscreen mode Exit fullscreen mode

Find the dependencies section in this file. Add the following line as a new implementation in the appropriate area.



implementation "com.facebook.soloader:soloader:$soLoaderVersion"


Enter fullscreen mode Exit fullscreen mode

After the addition, you can rebuild the application. If you encounter any issues during the build process (I did not face any problems), try to resolve them.

After a successful build, it means that we did not experience any issues with the SoLoader upgrade.

For testing the solution, republish the app on Google Play. After the release is approved, test it with a Samsung Galaxy S24 device. I guess the application will likely work successfully.

Second Solution

If the first solution did not work, the only thing you need to do is upgrade your React Native version to a compatible or the latest version. However, keep in mind that such upgrades can bring new issues, so you need to proceed with caution.

If no issues occurred during the upgrade, you can test your application again. I cannot provide details on how the upgrade might affect your current application configuration, but it is possible that it will resolve the problem.

This solution might not guarantee 100% success and could take up your time. Therefore, you should try the first solution as a priority. I applied the first solution and managed to achieve successful results.

Conclusion

I believe that with the steps outlined above, you will most likely overcome this problem.

Since new devices have different configurations, they inevitably cause such issues in our applications.

To prevent problems, it is necessary to regularly check React Native and its dependent libraries. During this check, you should use test devices and carefully examine log files to measure the responses of the latest model devices.

In this context, you should also review the ANR (Application Not Responding) records provided by Google Play to check for any potential crashes.

Remember that maintenance is a crucial phase for software. When it is done systematically, it helps you identify and address many long-term issues in advance.

If you have any thoughts about the text, please share them. If I have made any incorrect statements, please correct me so that we can do our best to provide accurate information.

Thank you for reading.

Top comments (0)