React native app crash on apk launch after using realm - android

I have a react native app using realm for saving user json input to device storage, then send the json data to api when they have stable connection (not automatically).
It works perfectly when used in debugging mode, but when I build it to apk and install to android device (the same one used for debugging), it crashes instantly without even showing the splash screen.
dependencies :
"#react-native-async-storage/async-storage": "^1.17.7",
"#react-native-community/cameraroll": "^4.0.0",
"#react-native-community/geolocation": "^2.0.2",
"#react-native-community/masked-view": "^0.1.10",
"#react-navigation/native": "^5.7.3",
"#react-navigation/stack": "^5.9.0",
"axios": "^0.20.0",
"buffer": "^6.0.1",
"formik": "^2.1.5",
"immer": "^9.0.3",
"react": "16.13.1",
"react-native": "0.63.2",
"react-native-android-location-services-dialog-box": "^2.8.2",
"react-native-bootsplash": "^3.1.5",
"react-native-camera": "^3.40.0",
"react-native-dropdown-picker": "^3.7.0",
"react-native-fs": "^2.16.6",
"react-native-gesture-handler": "^1.7.0",
"react-native-html-to-pdf": "^0.8.0",
"react-native-image-crop-picker": "^0.35.1",
"react-native-linear-gradient": "^2.5.6",
"react-native-maps": "^0.27.1",
"react-native-material-buttons": "^0.6.0",
"react-native-material-ripple": "^0.9.1",
"react-native-material-textfield": "^0.16.1",
"react-native-paper": "^4.1.0",
"react-native-permissions": "^2.2.1",
"react-native-reanimated": "1.13.0",
"react-native-safe-area-context": "^3.1.7",
"react-native-screens": "^2.10.1",
"react-native-svg": "^12.1.0",
"react-native-vector-icons": "^7.1.0",
"react-redux": "^7.2.1",
"realm": "10.19.5",
"redux": "^4.0.5",
"redux-devtools-extension": "^2.13.8",
"redux-logger": "^3.0.6",
"redux-offline": "^2.0.0",
"redux-persist": "^6.0.0",
"redux-saga": "^1.1.3"
I'm stuck with this for two days now.
Found some similar issues and have try this approaches :
Use v10.20.0-beta.5 -> can't even launch in debugging
Removing react-native-reanimated
Disable hermes (never enabled in the first place)
add this to defaultConfig inside android/app/build.gradle :
ndk {
abiFilters 'arm64-v8a', 'x86_64'
}
But nothing fixes the crash.
*I can't use AsyncStorage because of the 1MB cursor limit, and I will need to save maximum of 60MB. And I'm holding react native upgrade to 0.69 for now, because of the project's time limit.
How can I run the apk without crashing?
Thanks a bunch for your help!

Related

My app closes instead of reloading after installing in app update

I am using react-native, and I want to add in app update to my app. At first I tried using sp-react-native-in-app-updates. But my app was closing after the update was done. "the expected behavior is to reload with the new version".
So I decided to go native and use native modules to implement in-app-update.for the native approach I have followed react-native-in-app-update. But, going native did not help me and My app closes when It's done installing the update. after the app closes if I open it again. it's the updated version. but, the expected behavior for the app is to immediately reloads after installing update.
To make sure I am doing everything in the right way. I have created an app from scratch and followed the same steps and I could get the desired result. The new app was reloading after installing the update.
Dependencies
"dependencies": {
"#ercpereda/react-native-accordion": "^2.0.6",
"#invertase/react-native-apple-authentication": "^1.1.2",
"#react-native-community/art": "^1.2.0",
"#react-native-community/cameraroll": "^4.1.2",
"#react-native-community/image-editor": "^2.3.0",
"#react-native-community/netinfo": "^4.6.1",
"#react-native-community/push-notification-ios": "^1.4.0",
"#react-native-firebase/analytics": "^6.0.4",
"#react-native-firebase/app": "^6.7.1",
"#sentry/react-native": "^1.1.0",
"axios": "^0.18.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"css-loader": "^0.28.11",
"eslint-config-rallycoding": "^3.2.0",
"firebase": "^4.11.0",
"fuse.js": "^3.2.1",
"grpc": "^1.24.2",
"lodash": "^4.17.15",
"moment": "^2.21.0",
"patch-package": "^6.4.7",
"react": "17.0.2",
"react-loading-skeleton": "^0.4.0",
"react-native": "0.67.2",
"react-native-album-list": "^0.1.2",
"react-native-animatable": "^1.2.4",
"react-native-branch": "^4.2.1",
"react-native-calendars": "^1.20.0",
"react-native-camera": "^3.9.0",
"react-native-camera-roll-picker": "^1.3.0",
"react-native-carousel-view": "^0.5.1",
"react-native-checkbox": "^2.0.0",
"react-native-chip-view": "0.0.9",
"react-native-country-picker-modal": "^0.8.0",
"react-native-device-info": "^8.4.9",
"react-native-easy-grid": "^0.1.17",
"react-native-easy-toast": "^1.1.0",
"react-native-fabric": "^0.5.1",
"react-native-fast-image": "^8.3.2",
"react-native-fbsdk": "^3.0.0",
"react-native-flexi-radio-button": "^0.2.2",
"react-native-freshchat-sdk": "^3.3.2",
"react-native-geocoder": "^0.5.0",
"react-native-geolocation-service": "^3.1.0",
"react-native-gesture-handler": "^1.10.3",
"react-native-google-places": "^3.1.2",
"react-native-i18n": "^2.0.12",
"react-native-image-carousel": "^0.4.4",
"react-native-image-pan-zoom": "^2.1.7",
"react-native-image-resizer": "^1.0.0",
"react-native-image-size": "1.1.2",
"react-native-image-view": "^2.0.5",
"react-native-image-zoom-viewer": "^2.2.13",
"react-native-linear-gradient": "^2.5.6",
"react-native-maps": "^0.26.1",
"react-native-material-textfield": "^0.16.1",
"react-native-mixpanel": "^1.1.4",
"react-native-modal-datetime-picker": "^4.13.0",
"react-native-modest-checkbox": "^3.0.1",
"react-native-multiple-select-list": "^1.0.4",
"react-native-onesignal": "^3.5.0",
"react-native-otp": "^1.0.0",
"react-native-permissions": "^3.0.1",
"react-native-phone-call": "^1.0.7",
"react-native-popup-dialog": "^0.14.52",
"react-native-progress": "^4.0.2",
"react-native-push-notification": "^3.1.9",
"react-native-rate": "^1.1.10",
"react-native-reanimated": "^1.13.4",
"react-native-remote-svg": "^1.2.0",
"react-native-responsive-dimensions": "^1.0.2",
"react-native-restart": "0.0.13",
"react-native-router-flux": "^4.2.0",
"react-native-safe-area-context": "^3.1.9",
"react-native-safe-area-view": "^1.1.1",
"react-native-screens": "^2.18.1",
"react-native-select-multiple": "^1.2.0",
"react-native-shadow": "^1.2.2",
"react-native-shimmer-placeholder": "^1.0.35",
"react-native-simple-dialogs": "1.1.0",
"react-native-simple-radio-button": "^2.7.2",
"react-native-smooth-pincode-input": "^1.0.3",
"react-native-snackbar": "^2.0.4",
"react-native-snap-carousel": "3.8.0",
"react-native-splash-screen": "^3.2.0",
"react-native-svg": "^6.3.1",
"react-native-svg-animated-linear-gradient": "^0.1.9",
"react-native-svg-image": "^2.0.1",
"react-native-view-overflow": "0.0.4",
"react-native-webview": "^7.6.0",
"react-redux": "^5.0.7",
"redux": "^3.7.2",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.2.0",
"rn-sliding-up-panel": "^2.4.5",
"sp-react-native-in-app-updates": "^1.1.6"
},
"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.66.2",
"react-native-bundle-visualizer": "^2.0.1",
"react-test-renderer": "17.0.2"
},
Testing and Logcat_output:
To download apps using internal app sharing, You need to turn on internal app sharing on your Google Play Store app.
Open the Google Play Store app Google Play.
Tap Menu Menu > Settings.
In the “About” section, tap the Play Store version 7 times.
After the Internal app sharing setting appears, tap the switch to turn on internal app sharing.
Tap Turn on.
then open
https://play.google.com/apps/test/RQBrzWd6q_k/ahAIGJVrejKye6LymizzTdIY85wCTjmWtdA_ZIZ7OtU36IJS7H2TfZAiTckX-cEhcSuEjFdaLyGAKH8Dgfu4T2gvYr
and install the app
now if you open the app. It will not detect an update. For your app to detect the update. you have to open
https://play.google.com/apps/test/RQBrzWd6q_k/ahAIGJVrehWQvkt_2QCjcFlIDTvbtyy43A3XsD1hTAsn3fFCXy3tQgWjc8-oxYTUzJvAJsWXEWyX282iWl3c-heGpA
now go to your app and hopfully your app will detect the update

React Native app is using less secure cipher algorithm (com.securepreferences.SecurePreferencesOld)

When publishing Android app built in React Native, I got and error from automatic tests in Google Play Developer Console pointing here
How to fix this in React Native? Is this purely RN problem or some of my native modules doing this? I do not have any custom native code which is using Cipher class.
I am using those RN modules:
"#kichiyaki/react-native-barcode-generator": "^0.6.7",
"#react-native-community/masked-view": "^0.1.11",
"#react-native-community/netinfo": "^6.0.0",
"#react-native-firebase/app": "^12.8.0",
"#react-native-firebase/crashlytics": "^12.8.0",
"#react-native-firebase/installations": "^12.8.0",
"#react-navigation/bottom-tabs": "^5.11.11",
"#react-navigation/native": "^5.9.4",
"#react-navigation/stack": "^5.14.5",
"react-native-biometrics": "^2.1.4",
"react-native-config": "^1.4.4",
"react-native-gesture-handler": "^1.10.3",
"react-native-linear-gradient": "^2.5.6",
"react-native-mmkv-storage": "^0.6.0",
"react-native-paper": "^4.9.2",
"react-native-qrcode-svg": "^6.1.1",
"react-native-reanimated": "^2.2.0",
"react-native-safe-area-context": "^3.2.0",
"react-native-screens": "^3.4.0",
"react-native-send-intent": "^1.2.3",
"react-native-svg": "^12.1.1",
"react-native-swipe-gestures": "^1.0.5",
"react-native-vector-icons": "^8.1.0",
"react-native-wallet-passes": "^1.2.2",
"react-native-webview": "^11.6.5",

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.

More than one file was found with OS independent path 'junit/runner/logo.gif'

I’m working on a project where I need to establish connection to printer with ESC-POS. Project is in react native and I currently test on Android emulator.
I’ve found package that would do what I need (https://github.com/leesiongchan/react-native-esc-pos) but when I try to build an app it gives over 330 errors like:
Duplicate class org.junit.runners.model.MultipleFailureException found in modules escposjava-1.0-SNAPSHOT.jar (escposjava-1.0-SNAPSHOT.jar) and junit-4.12.jar (junit:junit:4.12)`
Those errors occur for task :app:mergeDebugJavaResource and the messages are:
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
More than one file was found with OS independent path 'junit/runner/logo.gif'
I tried to apply answers from this question: More than one file was found with OS independent path 'META-INF/LICENSE' but nothing has changed.
Any help would be apprecieated.
Project dependencies
"dependencies": {
"#leesiongchan/react-native-esc-pos": "^0.8.0",
"#react-native-community/datetimepicker": "^2.6.0",
"#react-native-community/masked-view": "^0.1.10",
"#react-navigation/bottom-tabs": "^5.5.2",
"#react-navigation/drawer": "^5.9.0",
"#react-navigation/material-top-tabs": "^5.2.16",
"#react-navigation/native": "^5.7.3",
"#react-navigation/stack": "^5.9.0",
"axios": "^0.19.2",
"currency.js": "^2.0.3",
"formik": "^2.1.4",
"i18n-js": "^3.7.0",
"moment": "^2.27.0",
"native-base": "^2.12.1",
"react": "16.13.1",
"react-native": "0.62.2",
"react-native-calendars": "^1.300.0",
"react-native-elements": "^2.3.2",
"react-native-gesture-handler": "^1.6.1",
"react-native-html-to-pdf": "^0.8.0",
"react-native-keyboard-aware-scroll-view": "^0.9.2",
"react-native-localize": "^1.4.0",
"react-native-masked-text": "^1.13.0",
"react-native-modal": "^11.5.6",
"react-native-modal-datetime-picker": "^8.7.1",
"react-native-paper": "^3.10.1",
"react-native-print": "^0.6.0",
"react-native-reanimated": "~1.7.0",
"react-native-safe-area-context": "0.7.3",
"react-native-screens": "~2.2.0",
"react-native-size-matters": "^0.3.0",
"react-native-sqlite-storage": "modified for project",
"react-native-tab-view": "^2.14.4",
"react-native-vector-icons": "6.6.0",
"react-redux": "^7.2.0",
"redux": "^4.0.5",
"redux-saga": "^1.1.3",
"reflect-metadata": "^0.1.13",
"typeorm": "modified for project",
"url": "^0.11.0",
"yup": "^0.29.1"
},
I kept searching other questions related to android and finally found this:
Duplicate Hamcrest and JUnit classes after updating Gradle and Android Studio to 3.5
So basically all I did was to add to build.gradle (:app)
android {
...
configurations {
compile.exclude group: "junit", module: "junit"
}
...
}
Now project builds and app starts.

React Native | #react-native-community_picker is not resolved on android

I'm using React Native Boilerplate for my mobile application. This is the first time I'm running it. It is working fine on ios simulator but showing error on android emulator.
Below error is showing on while running run-android
A problem occurred configuring project ':#react-native-community_picker'.
> Could not resolve all artifacts for configuration ':#react-native-
community_picker:classpath'.
> Could not resolve com.android.tools.build:gradle:3.2.1.
Required by:
project :#react-native-community_picker
> Could not resolve com.android.tools.build:gradle:3.2.1.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.2.1/gradle-3.2.1.pom'.
> sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
I tried installing this npm #react-native-community/picker and run again. It is not working.
packag.json
"#react-native-community/masked-view": "^0.1.10",
"#react-native-community/picker": "^1.6.5",
"#react-navigation/native": "^5.5.0",
"#react-navigation/stack": "^5.4.1",
"axios": "^0.19.2",
"immer": "^6.0.9",
"intl": "^1.2.5",
"react": "^16.13.1",
"react-intl": "^2.8.0",
"react-native": "0.62.2",
"react-native-gesture-handler": "^1.6.1",
"react-native-reanimated": "^1.9.0",
"react-native-safe-area-context": "^3.0.2",
"react-native-screens": "^2.8.0",
"react-redux": "^7.2.0",
"redux-saga": "^1.1.3",
"reselect": "^4.0.0"
Thanks in advance!
I just updated this npm #react-native-community/picker. It is working now.
updated Package.json
"#react-native-community/picker": "^1.6.6",
"#react-navigation/native": "^5.5.0",
"#react-navigation/stack": "^5.4.1",
"axios": "^0.19.2",
"immer": "^6.0.9",
"intl": "^1.2.5",
"native-base": "^2.13.13",
"react": "^16.13.1",
"react-intl": "^2.8.0",
"react-native": "0.62.2",
"react-native-gesture-handler": "^1.6.1",
"react-native-reanimated": "^1.9.0",
"react-native-safe-area-context": "^3.0.2",
"react-native-screens": "^2.8.0",
"react-native-swipe-list-view": "^3.2.3",
"react-redux": "^7.2.0",
"redux-saga": "^1.1.3",
"reselect": "^4.0.0"```

Categories

Resources