Expo/React native application crash on physical device trough APK installation - android

I'm currently building a React Native application with Expo. When running the application with the local server and the Expo Go application I dont have any issue. App run well on IOS and Android devices.
Now I'm trying to build an APK of the application for test purposes inside my team. To build it I followed [this documentation to use eas](https://docs.expo.dev/build-reference/apk/).
Now the apk install on the Android device but if I click on any button (they all trigger a navigate action onPress) the app crash instantly. I was using TouchableOpacity and I changed everyone of them to Pressable so the probleme does not come from the button. I'm wondering if i could come from the navigation system ?
Here is the dependencies of my project :
"dependencies": {
"#react-native-async-storage/async-storage": "^1.17.11",
"#react-navigation/native": "^6.1.1",
"#react-navigation/native-stack": "^6.9.6",
"#reduxjs/toolkit": "^1.9.1",
"#rneui/base": "^4.0.0-rc.7",
"#rneui/themed": "^4.0.0-rc.7",
"expo": "~47.0.13",
"expo-camera": "~13.1.0",
"expo-file-system": "~15.1.1",
"expo-location": "~15.0.1",
"expo-mail-composer": "~12.0.0",
"expo-media-library": "~15.0.0",
"expo-status-bar": "~1.4.2",
"jszip": "^3.10.1",
"react": "18.1.0",
"react-native": "0.70.5",
"react-native-safe-area-context": "4.4.1",
"react-native-screens": "~3.18.0",
"react-native-uuid": "^2.0.1",
"react-navigation": "^4.4.4",
"react-navigation-stack": "^2.10.4",
"react-redux": "^8.0.5",
"redux": "^4.2.0",
"redux-persist": "^6.0.0"
}
Thank you 🙏

Finally found the answer here
I forgot a GestureHandlerRootView at the root of my application 😅.

Related

React Native Built App is closing unexpectedly

Okay, I've been struggling for the last two days and this is it. I'm developing my first React Native android app using React Native CLI and using the following Packages:
"dependencies": {
"#react-native-masked-view/masked-view": "^0.2.6",
"#react-navigation/drawer": "^6.3.1",
"#react-navigation/material-bottom-tabs": "^6.1.1",
"#react-navigation/material-top-tabs": "^6.1.1",
"#react-navigation/native": "^6.0.8",
"#react-navigation/stack": "^6.1.1",
"react": "17.0.2",
"react-native": "0.67.3",
"react-native-gesture-handler": "^2.3.2",
"react-native-immersive": "^2.0.0",
"react-native-linear-gradient": "^2.5.6",
"react-native-material-textinput": "^1.3.0",
"react-native-pager-view": "^5.4.15",
"react-native-paper": "^4.11.2",
"react-native-reanimated": "^2.4.1",
"react-native-safe-area-context": "^4.2.1",
"react-native-screens": "^3.13.1",
"react-native-svg": "^12.3.0",
"react-native-tab-view": "^3.1.1",
"react-native-vector-icons": "^9.1.0"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"#babel/runtime": "^7.12.5",
"babel-jest": "^26.6.3",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.66.2",
"react-native-svg-transformer": "^1.0.0",
"react-test-renderer": "17.0.2"
},
In the Development mode, The App works just fine and smooth. I'm developing the app without any errors. But, When I built the app for production into aab and apk files, the issue arises. If I run the app, whether via npx react-native run-android --variant=release or installing the app on my physical device, the app just close instantly after opening. Here's the GitHub Repo Link
Note: I'm developing the app in Windows 10 with the latest Android Studio and all the latest versions of dependencies.
Preview: App on Production Mode
Preview: App on Development Mode
Please run the app in the simulator with LogCat running and check the error message there. That should give some indication, like this it could be anything. If logcat does not automatically run in your android studio you can open a terminal and run:
adb logcat
The problem was in my android/app/build.gradle file. I've changed following values:
def enableProguardInReleaseBuilds = false
def enableSeparateBuildPerCPUArchitecture = false
universalApk false
If I keep those unchanged, the builds work perfectly and smoothly. Can anyone please describe the reason?
This issue can occur due to variations from libs version incompatibilities, missing files and configuration...
In my case it was a missing key in file in:
Info.plist
<key>NSUserTrackingUsageDescription</key>
<string>$(PRODUCT_NAME) requires your permission to track in order to show you more relevant ads.</string>
Try looking at the simulator error log..

Firestore access via Firebase times out (React Native app)

I have a React Native app that was built using Expo. At launch it connects to Firestore and attempts to load 3 documents from a particular collection. It happens that at the moment that collection temporarily has no security restrictions. The app words great in the Expo emulation environment or when I've used a build from Expo to create an APK of the app.
Here's the problem. I have used the expo run:android command to export the code, built and installed the app and tried running it on either an emulator OR an Android phone (via WiFi or USB). In these cases when the app launches, it gets this error:
#firebase/firestore: Firestore (8.7.0): Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds.
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.
To try to troubleshoot this further, I inserted a fetch (using node-fetch) to a web site just to do a GET request. I did that just before the first Firestore code. It succeeds in all these environments, so I am certain it's not a network connectivity issue. There must be something about my Firebase app config, the identity of the app or something else that is either blocking this at a security level or needs to be configured on the device for Firestore access to work.
What should I explore? Are there diagnostic details I can provide that would help figure this out? These are the npm versions if you are curious.
"#expo/vector-icons": "^12.0.0",
"#react-native-async-storage/async-storage": "~1.15.0",
"#react-native-community/masked-view": "0.1.10",
"#react-native-community/slider": "3.0.3",
"#react-navigation/bottom-tabs": "5.11.2",
"#react-navigation/drawer": "^5.12.5",
"#react-navigation/native": "~5.8.10",
"#react-navigation/stack": "~5.12.8",
"diff-match-patch": "^1.0.5",
"diff-match-patch-line-and-unicode-aware-word": "^0.2.2",
"eslint": "^7.23.0",
"expo": "^42.0.0",
"expo-asset": "~8.3.2",
"expo-av": "~9.2.3",
"expo-constants": "~11.0.1",
"expo-font": "~9.2.1",
"expo-intent-launcher": "~9.1.0",
"expo-linking": "~2.3.1",
"expo-localization": "~10.2.0",
"expo-network": "~3.2.0",
"expo-permissions": "~12.1.1",
"expo-splash-screen": "~0.11.2",
"expo-status-bar": "~1.0.4",
"expo-web-browser": "~9.2.0",
"firebase": "^8.7.0",
"git": "^0.1.5",
"i18n-js": "^3.8.0",
"install": "^0.13.0",
"lodash": "^4.17.21",
"moment": "^2.29.1",
"npm": "^7.6.3",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "~0.63.4",
"react-native-gesture-handler": "~1.10.2",
"react-native-material-menu": "^1.2.0",
"react-native-popup-menu": "^0.15.10",
"react-native-progress": "^4.1.2",
"react-native-safe-area-context": "3.2.0",
"react-native-screens": "~3.4.0",
"react-native-tiny-toast": "^1.0.7",
"react-native-web": "~0.13.12",
"react-native-webview": "11.6.2",
"expo-updates": "~0.8.0",
"react-native-reanimated": "~2.2.0",
"react-native-unimodules": "~0.14.3"
I found a lot of useful suggestions to a related question and among the answers was a suggestion to try long polling.
firebase.firestore().settings({experimentalForceLongPolling: true})
I also attempted to use the following, but it did not work consistently.
firebase.firestore().settings({experimentalAutoDetectLongPolling: true, merge: true})
You can find more information about these two settings in the [Firebase Firestore documentation.

Google Play will deny the use of location in the background (Warning Email), Expo React native

We have received an email from google play, where it warns us that one of our apps is using localization in the background, and we have to change that before next year, but I already checked the app and I'm not using localization in the background.
This is the email
Is this happening to someone else? I don't know what to do because they ask me to remove that service but I'm not really using it
this is my package.json (dependencies I'm using )
"dependencies": {
"#react-native-community/datetimepicker": "2.4.0",
"#react-native-community/masked-view": "0.1.10",
"#react-navigation/native": "^5.1.6",
"#react-navigation/stack": "^5.2.11",
"axios": "^0.19.2",
"babel-runtime": "^6.26.0",
"big-integer": "^1.6.48",
"expo": "^38.0.0",
"expo-barcode-scanner": "~8.2.1",
"expo-crypto": "~8.2.1",
"expo-file-system": "~9.0.1",
"expo-media-library": "~8.2.1",
"expo-sharing": "~8.2.1",
"firebase": "7.9.0",
"react": "16.11.0",
"react-dom": "16.11.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz",
"react-native-animatable": "^1.3.3",
"react-native-camera": "^3.23.1",
"react-native-fs": "^2.16.6",
"react-native-gesture-handler": "~1.6.0",
"react-native-picker-select": "^7.0.0",
"react-native-qrcode-scanner": "^1.4.0",
"react-native-qrcode-svg": "^6.0.6",
"react-native-reanimated": "~1.9.0",
"react-native-responsive-screen": "^1.4.1",
"react-native-safe-area-context": "~3.0.7",
"react-native-screens": "~2.9.0",
"react-native-sha256": "^1.3.6",
"react-native-share": "^3.3.0",
"react-native-svg": "12.1.0",
"react-native-vector-icons": "^6.6.0",
"react-native-web": "~0.11.7",
"react-navigation": "^4.3.7",
"rn-fetch-blob": "^0.12.0"
},
please refer to this docs page: https://docs.expo.io/distribution/app-stores/#android-permissions
Permissions are configured via the android.permissions key in your app.json file
By default, your app will include all permissions supported by Expo. This is so that your standalone app will match its behavior in the Expo client and simply "work out of the box" no matter what permissions you ask for, with hardly any configuration needed on your part.
There are some drawbacks to this. For example, let's say your To-do list app requests CAMERA permission upon installation. Your users may be wary of installing since nothing in the app seems to use the camera, so why would it need that permission?
To remedy this, simply add the android.permissions key in your app.json file, and specify which permissions your app will use. A list of all Android permissions and configuration options can be found here.
To use only the minimum necessary permissions that Expo requires to run, set "permissions" : []. To use those in addition to CAMERA permission, for example, you'd set "permissions" : ["CAMERA"].
Try this :
By default, expo adds all permission in the app manifest. To remove all permission
add "permissions" : [] in your app.json file
keep it empty []
example :
"android": {
"package": "com.sahilnetic.appmojo",
"versionCode": 1,
"permissions" : []
},
now run
expo build:android -t app-bundle
then upload the bundle to the google play store

How to install dependencies from package.json?

So, I have a NaticeScript project which requires a bunch of modules. I'm familiar with Node.Js but new to NativeScript. Here's my package.json. I'm not able to run the project because it doesn't have all the modules.
"dependencies": {
"#proplugins/nativescript-dom": "^2.2.1",
"#proplugins/nativescript-master-technology": "^1.2.0",
"#proplugins/nativescript-permissions": "^1.5.0",
"#proplugins/nativescript-platform-css": "^1.8.0",
"#proplugins/nativescript-purchase": "^4.0.1",
"#proplugins/nativescript-zxing": "^1.7.0",
"bad-words": "^3.0.3",
"guid-typescript": "^1.0.9",
"is-integer": "^1.0.7",
"is-number": "^7.0.0",
"is-positive-integer": "^1.1.1",
"is-url": "^1.2.4",
"js-seeder": "^1.0.1",
"nativescript-appavailability": "^1.3.2",
"nativescript-barcodescanner": "^3.4.2",
"nativescript-camera": "^4.5.0",
"nativescript-carousel": "^6.1.1",
"nativescript-effects": "^1.0.0",
"nativescript-image": "^3.0.5",
"nativescript-imagepicker": "^7.1.0",
"nativescript-iqkeyboardmanager": "^1.5.1",
"nativescript-masked-text-field": "^4.0.3",
"nativescript-phone": "^1.4.1",
"nativescript-plugin-firebase": "^10.5.2",
"nativescript-plugin-universal-links": "^1.0.1",
"nativescript-social-share": "^1.6.0",
"nativescript-ui-listview": "^8.1.0",
"nativescript-vibrate": "^3.0.0",
"tns-core-modules": "^6.5.1"
},
"devDependencies": {
"nativescript-dev-webpack": "^1.5.1",
"node-sass": "^4.13.1",
"sass-loader": "^8.0.2",
"typescript": "~3.5.3"
},
How do I install all of these dependencies? My node version is 8.9.4 and the NPM version is 5.6.0. Please don't ask why don't I have the latest. Please, suggest ways with NPM and not with HomeBrew etc.
I have even tried:
tns plugin add nativescript-platform
npm i
And possibly everything.
But this complains that nativescript-globalevents isn't found and when I install globalscripts, it complains platform isn't found!
I even tried adding modules one by one but it'd give me error all the time
npm install #proplugins/nativescript-globalevents#1.3.0 --save
This results in: npm ERR! 404 Not Found: #proplugins/nativescript-globalevents#1.3.0
Just an FYI: I already have the nativescript installed v6.8.0
Thanks!
It is because you are using a package from ProPlugins.
As per their site: ProPlugins is a curated, tested, documented, demo'd, highly supported group of NativeScript plugins; from the top trusted authors in the community.
You will need to pay them a subscription if you want to access their curated plugins.
The reason why you are getting the ERR! 404 Not Found: #proplugins/nativescript-globalevents#1.3.0 is because you don't have access to the private repository. Hence the status 400+.
Try $ tns install [--path]
--path - Specifies the directory which contains the package.json file, if different from the current directory.
For a specific module tns install <Module>
The documentation is https://docs.nativescript.org/tooling/docs-cli/project/configuration/install

"Property description must be an object error" in non debug mode while executing command react-native run-android

I have this react-native project and its been running fine for the past 2 months but now I am getting an error "Property description should be and object" while running the build on android in a non-debug mode. It works very well in debug-mode and on IOS. Can somebody please guide? here is my package.json
Tried downgrading redux to 4.0.0 and put resolutions for babel in package.json. But nothing works and the error persists.
"react-native": "0.58.4",
"react-native-action-picker": "^1.0.2",
"react-native-base64": "0.0.2",
"react-native-cli": "^2.0.1",
"react-native-color-palette": "^2.0.2",
"react-native-confirmation-code-input": "^1.0.4",
"react-native-customized-image-picker": "^0.1.5",
"react-native-vector-icons": "^6.6.0",
"react-navigation": "^2.14.2",
"react-redux": "^6.0.1",
"redux": "^4.0.1",
"redux-logger": "^3.0.6",
"redux-persist": "^5.10.0",
"redux-promise": "^0.6.0",
"redux-thunk": "^2.3.0",
update npm. redux 4.0.4 work for me
[Just a workaround in case you can't afford to update dependency]
I got the same error in redux, I solved it.
Simply go to: node_modules/redux/lib/redux.js
and replace the line:
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(arguments[i], key));
to this:
var descriptor = Object.getOwnPropertyDescriptor(arguments[i], key);
if (descriptor) {
Object.defineProperty(target, key, descriptor);
}

Categories

Resources