Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crashes randomly - only Android 12 and mostly Samsung devices #3294

Closed
1 of 3 tasks
ilyagru opened this issue Jun 13, 2022 · 25 comments
Closed
1 of 3 tasks

App crashes randomly - only Android 12 and mostly Samsung devices #3294

ilyagru opened this issue Jun 13, 2022 · 25 comments
Labels
Needs review Issue is ready to be reviewed by a maintainer Platform: Android This issue is specific to Android Repro provided A reproduction with a snippet of code, snack or repo is provided

Comments

@ilyagru
Copy link

ilyagru commented Jun 13, 2022

Description

I'm opening an issue here for one which is reported to the React Native team. Could you take a look please? Maybe it is related? I think the react-native-reanimated team might have some fresh ideas on how to resolve it.

Expected behavior

No crash.

Actual behavior & steps to reproduce

To reproduce you need at least:

  1. Android 12
  2. Samsung device
  3. React Native 0.68.2

Crashes as facebook/react-native#33375 (comment)

Please see the whole thread for more logs and info.

Snack or minimal code example

For example, here is a reproduction facebook/react-native#33375 (comment)
https://github.com/jefersonvinicius/react-native-crashing-example

Package versions

This information is also available in the thread.

name version
react-native 0.68.2
react-native-reanimated ^2.8.0
NodeJS
Xcode
Java
Gradle
expo

Affected platforms

  • Android
  • iOS
  • Web
@ilyagru ilyagru added the Needs review Issue is ready to be reviewed by a maintainer label Jun 13, 2022
@github-actions github-actions bot added Missing repro This issue need minimum repro scenario Platform: Android This issue is specific to Android labels Jun 13, 2022
@software-mansion software-mansion deleted a comment from github-actions bot Jun 13, 2022
@piaskowyk piaskowyk added Repro provided A reproduction with a snippet of code, snack or repo is provided and removed Missing repro This issue need minimum repro scenario labels Jun 13, 2022
@github-actions github-actions bot added Missing repro This issue need minimum repro scenario and removed Repro provided A reproduction with a snippet of code, snack or repo is provided labels Jun 13, 2022
@jarredt
Copy link

jarredt commented Jun 13, 2022

We are having this issue as well, except we're on React Native 0.64.3. Only seeing it on Samsung devices on Android 12.

@jarredt
Copy link

jarredt commented Jun 13, 2022

Wondering if #3080 is related.

@ilyagru
Copy link
Author

ilyagru commented Jun 14, 2022

Yes @jarredt it seems occuring only on Samsungs with Android 12. #3080 might be related. It looks like many people who updating their devices to Android 12 and start experience the crash, even in different React Native apps. Any ideas for a workaround?

@jarredt
Copy link

jarredt commented Jun 14, 2022

Nope, spent several days on it and it seemed to be tied to our introduction of reanimated to our app, so we ultimately removed reanimated and went in a different direction.

@webdevmario
Copy link

expo: 45.0.0
react-native: 0.68.2
react-native-reanimated: 2.8.0

I too noticed this issue cropping up amongst Android 12/Samsung devices once we upgraded to Expo SDK 45.

Our app makes use of React Navigation 6 and react-native-reanimated is a dependency so I cannot remove it.

I created a minimal Expo test app to evaluate and it is if in fact the addition of this package that causes it to crash on Android 12/Samsung devices. If I remove it, the crashing stops.

#3080 does seem to be related.

facebook/react-native#33375 appears to be the root issue/cause. Some comments suggest RN 0.69.0 will address but it would be good to have some confirmation from RN devs + react-native-reanimated devs on Samsung devices.

Below is the code I used for my test. Take out reanimated and it should stop crashing on these devices.

{
  "name": "expo-demo",
  "version": "1.0.0",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject"
  },
  "dependencies": {
    "@react-navigation/native": "^6.0.10",
    "@react-navigation/stack": "^6.2.1",
    "expo": "~45.0.0",
    "expo-splash-screen": "~0.15.1",
    "expo-status-bar": "~1.3.0",
    "expo-updates": "~0.13.2",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "react-native": "0.68.2",
    "react-native-reanimated": "~2.8.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9"
  },
  "private": true
}
// App.js

import * as SplashScreen from 'expo-splash-screen';
import React, { useEffect, useState } from 'react';
import RootNavigator from './src/navigation/RootNavigator';

export default function App() {
  const [appIsReady, setAppIsReady] = useState(false);

  useEffect(() => {
    async function initApp () {
      try {
        await SplashScreen.preventAutoHideAsync();
      } catch (e) {
        console.log(e);
      } finally {
        setAppIsReady(true);
      }
    }

    initApp();
  }, []);

  if (!appIsReady) {
    return null;
  }

  return (
    <RootNavigator />
  );
}
// RootNavigator.js

import * as SplashScreen from 'expo-splash-screen';
import React, { useEffect, useState } from 'react';
import RootNavigator from './src/navigation/RootNavigator';

export default function App() {
  const [appIsReady, setAppIsReady] = useState(false);

  useEffect(() => {
    async function initApp () {
      try {
        await SplashScreen.preventAutoHideAsync();
      } catch (e) {
        console.log(e);
      } finally {
        setAppIsReady(true);
      }
    }

    initApp();
  }, []);

  if (!appIsReady) {
    return null;
  }

  return (
    <RootNavigator />
  );
}

@github-actions github-actions bot added Repro provided A reproduction with a snippet of code, snack or repo is provided and removed Missing repro This issue need minimum repro scenario labels Jun 18, 2022
@ilyagru
Copy link
Author

ilyagru commented Jul 13, 2022

Hi! Any update on this one? RN 0.69.1 hasn't resolved this issue. And since there is a repro, could anyone from maintainers please take a look?

@webdevmario
Copy link

webdevmario commented Jul 13, 2022

@ilyagru Disappointing to read that 0.69.1 does not address. facebook/react-native#33375 has a lot of activity as of late. I noticed this issue says "1 of 3 tasks" complete. Do all 3 need to complete before maintainers start taking a look?

@ilyagru
Copy link
Author

ilyagru commented Jul 13, 2022

@webdevmario "1 of 3 tasks" means it is not related to tasks but to the affected platforms, it occurs only on Android, hence 1 checkbox is checked.

@webdevmario
Copy link

webdevmario commented Jul 13, 2022

@ilyagru Ah, I see. Thank you for clarifying. Definitely just Android. 😫

@RhyG
Copy link

RhyG commented Jul 29, 2022

Hi, just wondering if anyone knows of any movement on this issue? I can see in the thread in the react-native repo there has been a bunch of comments and a repro, but no updates or fixes. This is currently affecting quite a lot of our users, is there anything that could be done in the meantime to prevent this error from happening? Keen to help where possible, but not at all a native developer sadly.

@MuhammadRafeh
Copy link

Any updates?

@robertwt7
Copy link

could this be related to #3234? we are experiencing the same issue, it seems like it happens when using predefined animations, in my case is FadeInUp

@joviksdev
Copy link

Having similar issues too, application crashes on android 12, Samsung device, has there been a fix on this?

@bangdy
Copy link

bangdy commented Aug 29, 2022

I also have crash on my release at first time only for Samsung android 12 phone.
I need to maintain react-native-reanimated for react-navigation/drawer.
So, not fundamental solution,

  1. I used react-native-restart for resetting app first time only.
  2. I used react-native-device-info check Samsung and 12 version

It could be temporary solution.
(In my case, after mounting of navigation's drawer, reset needs to be executed. After a few times of test, I chose 2s)

// MainComponent.js 
...
useEffect(() => {
    const checkFirst = async () => {
      const brand = await getBrand();
      const version = await getSystemVersion();
      getItemFromAsync('notFirst').then(notFirst => {
        if (!notFirst && brand === 'samsung' && version === '12') {
          setItemToAsync('notFirst', true);
          setTimeout(() => {
            RNRestart.Restart();
          }, 2000);
        }
      });
    };

    checkFirst();
  }, []);
...

@vincemavill
Copy link

I solve the issue by changing targetSdkVersion = 31 to argetSdkVersion = 30

@vjsingh95
Copy link

maintain react-native-reanimated for react-navigation/drawer.
So, not fundamental solution,

How you uploaded the app with targetSdkVersion 30 ? Google play console is asking for target 31 or higher.

@codal-mpawar
Copy link

right @vjsingh95 if we need to upload the app on the google play console then it must targetSdkVersion = 31.

@jonathanroze
Copy link

Did you find a way to fix this issue ? Thanks

@grant-solomons
Copy link

I am also experiencing this issue just on samsung devices

@vjsingh95
Copy link

Please add below line to build gradle file.

implementation 'androidx.work:work-runtime:2.7.1'

@jonathanroze
Copy link

Please add below line to build gradle file.

implementation 'androidx.work:work-runtime:2.7.1'

Thanks, I already try this way, an this error is still throw on Android 12!

@lakshminarayana254
Copy link

Any solution for this? Notifications working when app in foreground but in background not working in targetsdkversion 31.

@adityabrovitech
Copy link

adityabrovitech commented May 6, 2023

Any solution for this? Notifications working when app in foreground but in background not working in targetsdkversion 31.

you should add POST_NOTIFICATION permission for targetsdkversion-31 android 13

@Arise-cn
Copy link

Did you find a way to fix this issue ? Thanks

@Latropos
Copy link
Contributor

Closing since we have limited our support for Reanimated v2 since release of the Reanimated 3, please upgrade

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs review Issue is ready to be reviewed by a maintainer Platform: Android This issue is specific to Android Repro provided A reproduction with a snippet of code, snack or repo is provided
Projects
None yet
Development

No branches or pull requests