Stuck on black screen when activating debug in React-Native - android

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.

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.

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.

How to fix "EISDIR: illegal operation on a directory, read error" on react native android emulator with react native debug mode enabled

I am new to React and React Native and I am stuck with debugging process. I have used redux and want to check the action and state changes in the redux debug tool.
Following steps I have followed:
Installed Redux DevTool extension in chrome
Installed npm install --save-dev redux-devtools-extension
Configured this in App.js as follows
import { composeWithDevTools } from 'redux-devtools-extension';
const store = createStore(rootReducers, composeWithDevTools());
Pressed Control + M in emulator clicked on Start Debugging.
Reloaded the app.
Got Error
Error: EISDIR: illegal operation on a directory, read at Object.readSync (fs.js:592:3) at tryReadSync (fs.js:366:20) at Object.readFileSync (fs.js:403:19) at UnableToResolveError.buildCodeFrameMessage(/home/gaurav/reactproject/shopping/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:347:17) at new UnableToResolveError (/home/gaurav/reactproject/shopping/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:333:35) at ModuleResolver.resolveDependency (/home/gaurav/reactproject/shopping/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:211:15) at DependencyGraph.resolveDependency (/home/gaurav/reactproject/shopping/node_modules/metro/src/node-haste/DependencyGraph.js:413:43) at /home/gaurav/reactproject/shopping/node_modules/metro/src/lib/transformHelpers.js:317:42 at /home/gaurav/reactproject/shopping/node_modules/metro/src/Server.js:1471:14 at Generator.next (<anonymous>)
If debug mode is stopped, I don't get any error in the terminal. Following are dependencies in the project.
"dependencies": {
"#react-native-community/masked-view": "^0.1.10",
"#react-navigation/native": "^5.9.3",
"#react-navigation/stack": "^5.14.3",
"react": "17.0.1",
"react-native": "0.64.0",
"react-native-gesture-handler": "^1.10.3",
"react-native-reanimated": "^2.0.0",
"react-native-safe-area-context": "^3.2.0",
"react-native-screens": "^2.18.1",
"react-native-vector-icons": "^8.1.0",
"react-navigation-header-buttons": "^7.0.0",
"react-redux": "^7.2.2",
"redux": "^4.0.5"
},
"devDependencies": {
"#babel/core": "7.13.10",
"#babel/runtime": "7.13.10",
"#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-devtools": "^4.10.1",
"react-test-renderer": "17.0.1",
"redux-devtools-extension": "^2.13.9"
},
In the emulator, I also got errors as showing in the screenshot.
It would be a great help if anyone could help in finding a solution to that.
Thanks.

React Native - Android app restarts on background

My react-native android app restarts on background even in AdMob ads.
I newly added Google-AdMob ads to my app but when I take it to the background or watch Interstitial ads in the app, it restarts and starts over from the splash screen.
"dependencies":
"firebase": "^5.0.4",
"native-base": "^2.4.3",
"react": "16.3.1",
"react-native": "0.55.3",
"react-native-admob": "^2.0.0-beta.5",
"react-native-elements": "^0.19.1",
"react-native-fetch-blob": "^0.10.8",
"react-native-share": "^1.0.27",
"react-native-storage": "^0.2.2",
"react-native-vector-icons": "^4.6.0",
"react-native-video": "^2.0.0",
"react-native-view-shot": "^2.4.0",
"react-navigation": "^1.5.11",
"tty": "^1.0.1"
"devDependencies":
"babel-jest": "22.4.3",
"babel-preset-react-native": "4.0.0",
"jest": "22.4.3",
"react-test-renderer": "16.3.1"

Release APK crash on start - React Native

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

Categories

Resources