React- Native .apk file failing in higher version of android devices - android

I have created .apk of my create the native project. It is working fine in android 5 and 6 version devices. It is failing in the higher version of the devices.
I have used below link to create the signed apk file.
https://facebook.github.io/react-native/docs/signed-apk-android#docsNav
When I installed the react-native project in higher version of the devices using react-native run-android it is working fine. But , in case of .apk it is failing.
Can you help me to resolve this,
my package.json file is ,
{
"name": "awsUpload",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"aws-sdk": "^2.395.0",
"link": "^0.1.5",
"react": "16.6.3",
"react-native": "^0.58.3",
"react-native-aws3": "0.0.8",
"react-native-device-info": "^0.26.2",
"react-native-fetch-blob": "^0.10.8",
"react-native-file-upload": "^1.0.4",
"react-native-image-picker": "^0.28.0",
"react-native-material-dropdown": "^0.11.1",
"react-native-navigator": "^0.4.2",
"react-native-router-flux": "^4.0.6",
"react-navigator": "0.0.0-0",
"uniqid": "^5.0.3"
},
"devDependencies": {
"babel-core": "7.0.0-bridge.0",
"babel-jest": "24.0.0",
"jest": "24.0.0",
"metro-react-native-babel-preset": "0.51.1",
"react-test-renderer": "16.6.3"
},
"jest": {
"preset": "react-native"
}
}
In logs, it is giving below error,
Failed to get property persist.sys.media.traces
java.lang.IllegalStateException: Handler (android.os.Handler) {e12e3b3} sending message to a Handler on a dead thread

I was fetching the device location using a set of codes. In the higher version of Android devices due to security reason, It was not allowing my app to fetch it. I add the android device permission by referring following link.
Link is,
https://stackoverflow.com/questions/45822318/how-do-i-request-permission-for-android-device-location-in-react-native-at-run-t

Related

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.

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.

React Native Maps - Smooth Movement of Marker from one coordinate to another

I am making an tracking app with RN 0.50.1, and using react-native-maps for showing user location on maps with custom image on MapView.Marker "image" props.
The location works fine, also the tracking works fine but the problem is the marker jumps from one co-ordinate to another on lat long change.
Have tried setting the state with MapView.AnimatedRegion and update the coordinates using timing method, but no luck.
Also have used https://github.com/airbnb/react-native-maps/blob/master/example/examples/AnimatedMarkers.js example but still no luck which explains to use Animated.Region, but it gives me error of Animated.Region is not a constructor.
I need a smooth movement of marker on lat long change.
My Package.JSON file -
{
"name": "XXXX",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"firebase": "^4.6.1",
"lottie-react-native": "^2.2.7",
"moment": "^2.19.1",
"react": "^16.0.0",
"react-native": "0.50.1",
"react-native-android-permissions": "^1.0.0",
"react-native-code-push": "^5.1.3-beta",
"react-native-maps": "^0.17.1",
"react-native-responsive-dimensions": "^1.0.1",
"react-native-router-flux": "^4.0.0-beta.22",
"react-native-simple-toast": "0.0.7",
"react-native-vector-icons": "^4.4.2"
},
"devDependencies": {
"babel-jest": "21.2.0",
"babel-preset-react-native": "4.0.0",
"jest": "21.2.1",
"react-test-renderer": "16.0.0"
},
"jest": {
"preset": "react-native"
}
}
Any help appreciated. Please.
I think you want to take a look at MapView methods (e.g. animateToCoordinates).

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