Release APK crash on start - React Native - android

I have an issue with react native release APK.
The app run on debug mode but it crash immediately on release mode
Got these message from the logcat which is probably causing this problem
Module AppRegistry is not a registered callable module (calling unmountApplicationComponentAtRootTag)
11-01 08:28:24.531 6644 6662 E ReactNativeJS: undefined is not an object (evaluating 'd.View.propTypes.style')
11-01 08:28:24.534 6644 6662 E ReactNativeJS: Module AppRegistry is not a registered callable module (calling runApplication)
Here is my packages :
{
"name": "jbw",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"color": "^2.0.0",
"intl": "^1.2.5",
"native-base": "^2.3.3",
"prop-types": "^15.6.0",
"react": "16.0.0-beta.5",
"react-native": "0.49.3",
"react-native-fontawesome": "^5.7.0",
"react-native-keyboard-aware-scroll-view": "^0.4.1",
"react-native-linear-gradient": "^2.3.0",
"react-native-loading-spinner-overlay": "^0.5.2",
"react-native-masked-text": "^1.6.2",
"react-native-modal": "^4.1.1",
"react-native-popup-dialog": "^0.9.38",
"react-native-super-grid": "^1.0.4",
"react-native-vector-icons": "^4.4.2",
"react-navigation": "^1.0.0-beta.15"
},
"devDependencies": {
"babel-jest": "21.2.0",
"babel-preset-react-native": "4.0.0",
"jest": "21.2.1",
"react-test-renderer": "16.0.0-beta.5"
},
"jest": {
"preset": "react-native"
}
}

Got the problem, caused by
View.PropTypes
deprecated on 0.49
should move to
import { ViewPropTypes } from 'react-native';

Try to do the following steps:
cd android
sudo ./gradlew clean
If not works, you can check your index.android.js on the line:
AppRegistry.registerComponent('MyAppName', () => MyRootComponent);
Verify if the name in (MyAppName) is the same of the name that are in MainActivity.java in the method getMainComponentName()

just make sure that you have:
"react-native": "0.50.3",
"react": "^16.0.0"
then do:
watchman watch-del-all
cd android
./gradlew clean
./gradlew assembleDebug
and everything will work well
credit to: #mobdim https://github.com/facebook/react-native/issues/16745#issuecomment-343443988
i should mention that i had to fix also the problem mentioned here by Ganesh Cauda

Related

My Expo stuck at splash screen after building it for android

I have used eas buidl -p android --profile preview to build my .apk file. But I am not getting why app is stuck at Splash Screen. I am not getting what is the cause. Please help me out and thank you in advance.
my pcakage.json
"name": "appName-mob",
"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",
"build": "eas build -p android"
},
"dependencies": {
"#expo-google-fonts/inter": "^0.2.2",
"#expo/vector-icons": "^13.0.0",
"#react-native-community/netinfo": "9.3.0",
"#react-navigation/bottom-tabs": "^6.3.3",
"#react-navigation/native": "^6.0.12",
"#react-navigation/native-stack": "^6.8.0",
"#tanstack/react-query": "^4.3.9",
"axios": "^0.27.2",
"expo": "~46.0.9",
"expo-app-loading": "~2.1.0",
"expo-font": "~10.2.0",
"expo-splash-screen": "~0.16.2",
"expo-status-bar": "~1.4.0",
"react": "18.0.0",
"react-icons": "^4.4.0",
"react-native": "0.69.6",
"react-native-gesture-handler": "~2.5.0",
"react-native-safe-area-context": "4.3.1",
"react-native-svg": "12.3.0",
"react-native-svg-transformer": "^1.0.0",
"react-native-view-more-text": "^2.1.0",
"expo-linear-gradient": "~11.4.0",
"#react-native-async-storage/async-storage": "~1.17.3"
},
"devDependencies": {
"#babel/core": "^7.18.6",
"babel-loader": "^8.2.5",
"babel-plugin-module-resolver": "^4.1.0",
"babel-preset-react-native": "^4.0.1",
"path": "^0.12.7"
},
"private": true
}```
in development mode clear application cache and storage then test your app
Thank you for your time. But this problem has been solved. Actually it wasn't a problem in the development server. So, I made a development build and ran my code there and got the log of UIManager Issue which was then resolved by installing react-native-screens. I would suggest if this happen to any of you again just make a development build and test your code there. It was very much helpful.

Stuck on black screen when activating debug in React-Native

I have a problem with my RN app in my android device (have not tested on iOS yet), as soon as I activate debug on the device, it gets stuck on a black screen.
I dont know what part of the code or what setting is causing this, and this is the reason I am not showing any coding here. Just trying to check if you guys have had the same problem before.
Here is what I have tried:
gradlew clean
react-native start --reset-cache
cleaned app data and cache in the device
uninstalled the app from the device
Here are the packages I have installed and using so far on my app:
{
"name": "bleconnect",
"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": {
"#ant-design/icons": "^4.7.0",
"#react-native-async-storage/async-storage": "^1.15.14",
"#react-native-community/blur": "^3.6.0",
"#react-native-community/masked-view": "^0.1.11",
"#react-native-firebase/app": "^14.7.0",
"#react-native-firebase/auth": "^14.2.1",
"#react-native-firebase/firestore": "^12.4.0",
"#react-native-firebase/functions": "^14.2.1",
"#react-native-firebase/storage": "^14.7.0",
"#react-navigation/drawer": "^6.3.1",
"#react-navigation/native": "^6.0.6",
"#react-navigation/stack": "^6.0.11",
"evil-icons": "^1.10.1",
"geofirestore": "^4.4.2",
"haversine": "^1.1.1",
"node": "^16.13.1",
"npm-check-updates": "^12.4.0",
"react": "17.0.1",
"react-chat-elements": "^11.0.1",
"react-content-loader": "^6.2.0",
"react-native": "0.64.2",
"react-native-animated-spinkit": "^1.5.2",
"react-native-countdown-circle-timer": "^3.0.6",
"react-native-device-info": "^8.1.5",
"react-native-elements": "^3.4.2",
"react-native-fast-image": "^8.5.11",
"react-native-gesture-handler": "^2.1.0",
"react-native-grid-image-viewer": "^1.3.0",
"react-native-image-crop-picker": "^0.37.3",
"react-native-image-picker": "^4.7.3",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-location": "^2.5.0",
"react-native-permissions": "^3.3.1",
"react-native-reanimated": "^2.8.0",
"react-native-reanimated-carousel": "^2.4.0",
"react-native-safe-area-context": "^3.3.2",
"react-native-screens": "^3.10.2",
"react-native-svg": "^12.3.0",
"react-native-vector-icons": "^8.1.0"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"#babel/runtime": "^7.12.5",
"#react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.6.3",
"eslint": "7.14.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.64.0",
"react-test-renderer": "17.0.1"
},
"jest": {
"preset": "react-native"
}
}
I would try to npm uninstall all packages and reinstall latest of all but there are specific versions of some libraries that I am using so I cant updated everything to the latest versions.
I have found a workaround. I force downgraded react-native-reanimated package to 2.2.4 and now the debugger works just fine.
npm i react-native-reanimated#2.2.4 --force
if you dont use --force command, it might fail downgrading.
try to run your project with android studio,i think it has errors that will show here.

Error: Requiring module "node_modules\react-native-reanimated\src\Animated.js"

I am making an app in react native expo. It runs on web browser but fails to run on android simulator or expo go app on my phone. i get 2 errors :-
Error: Requiring module "node_modules\react-native-reanimated\src\Animated.js", which threw an exception: Error: Reanimated 2 failed to create a worklet, maybe you forgot to add Reanimated's babel plugin?
Invariant Violation: "main" has not been registered. This can happen if:
Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
any help would be appreciated
my expo sdk : 44,
my package.json
{
"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-native-async-storage/async-storage": "~1.15.0",
"#react-native-community/masked-view": "^0.1.10",
"axios": "^0.24.0",
"expo": "^44.0.0",
"expo-status-bar": "~1.2.0",
"ngrok": "^4.2.2",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-gesture-handler": "~2.1.0",
"react-native-reanimated": "~2.3.1",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.10.1",
"react-native-web": "0.17.1",
"react-navigation": "^4.4.4",
"react-navigation-stack": "^2.10.4",
"react-navigation-tabs": "^2.11.0",
"react-native-maps": "0.29.4"
},
"devDependencies": {
"#babel/core": "^7.12.9"
},
"private": true
}
my babel.config
module.exports = function (api) {
api.cache(true);
return {
presets: ["babel-preset-expo"],
plugins: ["react-native-reanimated/plugin"],
};
};
As mentioned in the reanimated doc,
Install yarn add react-native-reanimated#next
Edit babel plugin config
module.exports = function (api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
plugins: ['react-native-reanimated/plugin'],
};
};
Clear Metro Bundler cache & start expo expo start --clear
That should solve the issue!
I've had the same error before, and I did 2 things:
Actually installed react-native-reanimated by typing
yarn add react-native-reanimated#next in cmd.
Made sure everything in my expo was up to date by typing
expo update and pressing y to get every module on the compatible version.
Stop the server
run expo r -c to clear the cache.

React native app crash without error log ,How to detect a bug?

I'm developing an android app in react native and it is crash when I install it to my android device, my android device is running on android 10.
package.json
{
"name": "WifiSwitch",
"version": "0.0.2",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"#react-native-community/async-storage": "^1.12.1",
"#react-native-community/masked-view": "^0.1.10",
"#react-native-community/viewpager": "^5.0.11",
"#react-navigation/native": "^5.8.10",
"#react-navigation/stack": "^5.12.8",
"axios": "^0.21.1",
"native-base": "^2.15.0",
"react": "16.13.1",
"react-native": "^0.65.1",
"react-native-android-wifi": "^0.0.41",
"react-native-best-viewpager": "^1.0.4",
"react-native-gesture-handler": "^1.9.0",
"react-native-image-picker": "^4.0.6",
"react-native-reanimated": "^1.13.2",
"react-native-safe-area-context": "^3.1.9",
"react-native-screens": "^2.16.1",
"react-native-tcp-socket": "^4.5.5",
"react-native-uuid": "^2.0.1",
"react-native-vector-icons": "^7.1.0"
},
"devDependencies": {
"#babel/core": "^7.12.10",
"#babel/runtime": "^7.12.5",
"#react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.6.3",
"eslint": "^7.17.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.64.0",
"react-test-renderer": "16.13.1"
},
"jest": {
"preset": "react-native"
}
}
I recommend you to debug your application using adb logcat
Steps to configure
Connect your device to your computer
Run adb devices to check out if your device is detected.
If the command doesn't work because "adb is not a command", go to your ANDROID_HOME path, then open platform-tools
Now run adb logcat: This command will output all logs (debug and error levels) coming from your Android Device.
Install your application again. I recommend you to use react-native run-android. More info: https://reactnative.dev/docs/running-on-device
When your app is going to crash, you will see a Crash Log in the adb logcat output. Search for your app package name.
For your convenience, you could as well have a look here to filter only your app: Filter LogCat to get only the messages from My Application in Android?
Whenever you get a crash log, a stack trace is also provided. That can help you trace the issue.

Android Google Play FATAL EXCEPTION: mqt_native_modules with React-Native app on Release APK

I'm struggling with my React Native app... It used to be deployed correctly with no errors before I updated many of the librairies I used in react-native, but now I have errors on Android & iOS.
It works fine with react-native run-android or with Android Studio, but my release APK does not pass Google Play tests.
Here is the Google Play logcat of the errors (partially) :
12-12 01:26:15.554: E/ReactNativeJS(13327): undefined is not an object (evaluating 'e.length')
12-12 01:26:15.556: I/Dpps(892): int DppsFeatureAd3::AdCalcCalibParams(struct DppsAdCfgParam &)():445 calib_a 14, calib_c 0, calib_d 0
12-12 01:26:15.558: E/ReactNativeJS(13327): Module AppRegistry is not a registered callable module (calling runApplication)
12-12 01:26:15.563: E/NetworkScheduler(11214): ignoring stale queue check message
12-12 01:26:15.563: E/NetworkScheduler(11214): --------- beginning of crash
12-12 01:26:15.564: E/AndroidRuntime(13327): FATAL EXCEPTION: mqt_native_modules
12-12 01:26:15.564: E/AndroidRuntime(13327): Process: com.mdef.mymatchup, PID: 13327
And here is my package.json :
{
"name": "my-app",
"version": "1.1.0",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"release": "cd android && ./gradlew assembleRelease",
"installRelease": "cd android && ./gradlew installRelease",
"test": "jest"
},
"dependencies": {
"babel-plugin-module-resolver": "3.0.0",
"babel-plugin-transform-remove-console": "6.8.5",
"d3-interpolate": "1.1.5",
"es6-symbol": "3.1.1",
"lodash": "~4.11.2",
"lodash.range": "3.2.0",
"module-resolver": "1.0.0",
"native-base": "2.3.5",
"native-base-shoutem-theme": "0.1.0",
"prop-types": "15.5.10",
"react": "16.0.0",
"react-native": "0.51.0",
"react-native-communications": "2.2.1",
"react-native-datepicker": "1.6.0",
"react-native-fetch-blob": "0.10.8",
"react-native-firebase-analytics": "4.0.1",
"react-native-image-crop-picker": "0.18.1",
"react-native-sentry": "0.30.2",
"react-native-splash-screen": "3.0.6",
"react-native-svg": "6.0.0",
"react-native-vector-icons": "4.4.2",
"react-navigation": "1.0.0-beta.10",
"react-redux": "5.0.5",
"redux": "3.7.2",
"redux-persist": "5.2.2",
"redux-thunk": " 2.2.0",
"striptags": "file:patch/striptags",
"react-native-fcm-opsone": "file:patch/react-native-fcm"
},
"devDependencies": {
"babel-jest": "19.0.0",
"babel-preset-react-native": "1.9.1",
"jest": "19.0.2",
"react-test-renderer": "~15.4.2"
},
"jest": {
"preset": "react-native"
},
"resolutions": {
"metro-bundler": "0.20.2",
"color-convert": "1.9.1",
"uglify-js": "github:alexlamsl/UglifyJS2#issue-2449"
}
}
I tried the answers of this issue but it did nothing.
React-Native: Module AppRegistry is not a registered callable module
Did somebody already had the same problem ? It's been 3 days now and I don't know what to do anymore... I need help please !
Issue solved ! I have fixed my problem by downgrading React-Native from 0.51.0 to 0.49.5, and I have no more crash.

Categories

Resources