So I've been working on a React Native project, I'm on a Mac and when I run my apk file generated by the command ./gradlew assembleRelease and install it on my Google Pixel 4a I try to open the app and it instantly crashes and closes. However, when I run it in the emulator via command react-native run-android it works as expected. During the build, installation and even opening the app on my actual device it never gives a single error. Nothing has changed to my knowledge since the last time I ran the build command and it was working before so I'm lost and confused as to why this is happening. This also my first react-native project so maybe being a noob I'm missing something very obvious. Also iOS has absolutely no issues, any feedback or tips would be greatly appreciated. Thanks
My build.gradle file:
buildscript {
ext {
googlePlayServicesLocationVersion = "17.0.0" // Or higher.
buildToolsVersion = "29.0.3"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "20.1.5948944"
appCompatVersion = "1.1.0"
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:4.1.0")
classpath 'com.google.gms:google-services:4.3.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
maven {
// react-native-background-fetch
url("${project(':react-native-background-fetch').projectDir}/libs")
}
maven {
// Required for react-native-background-geolocation
url("${project(':react-native-background-geolocation').projectDir}/libs")
}
maven {
// Required for zoho chat widget
url("https://maven.zohodl.com/")
}
maven {
// Required for react-native-background-fetch
url("${project(':react-native-background-fetch').projectDir}/libs")
}
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
// Do not change the username below.
// This should always be `mapbox` (not your username).
username = "mapbox"
// Use the secret token you stored in gradle.properties as the password
password = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
}
}
google()
jcenter()
maven { url 'https://www.jitpack.io' }
}
}
package.json
{
"name": "NAME",
"version": "1.2.8",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint .",
"build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'"
},
"dependencies": {
"@homee/react-native-mapbox-navigation": "^1.0.5",
"@react-native-async-storage/async-storage": "^1.15.5",
"@react-native-community/checkbox": "^0.5.8",
"@react-native-firebase/app": "11.5.0",
"@react-native-firebase/auth": "11.5.0",
"@react-native-firebase/firestore": "^11.5.0",
"@react-native-picker/picker": "^1.9.12",
"@react-navigation/bottom-tabs": "^6.0.0-next.2",
"@react-navigation/drawer": "^6.0.0-next.2",
"@react-navigation/native": "^6.0.0-next.1",
"@react-navigation/stack": "^6.0.0-next.6",
"axios": "^0.21.1",
"expo-web-browser": "^9.0.0",
"firebase": "^7.24.0",
"firebase-tools": "^8.16.2",
"mobx": "^6.1.8",
"mobx-react-lite": "^3.2.0",
"mobx-state-tree": "^5.0.1",
"moment": "^2.29.1",
"mst-persist": "^0.1.3",
"react": "17.0.1",
"react-native": "0.64.0",
"react-native-background-fetch": "^4.0.1",
"react-native-background-geolocation": "^4.0.1",
"react-native-datepicker": "^1.7.2",
"react-native-dropdown-picker": "^4.0.2",
"react-native-gesture-handler": "^1.10.3",
"react-native-modalize": "^2.0.8",
"react-native-paper": "^4.7.2",
"react-native-portalize": "^1.0.7",
"react-native-reanimated": "^2.0.0",
"react-native-safe-area-context": "^3.2.0",
"react-native-screens": "^2.18.1",
"react-native-unimodules": "^0.12.0",
"react-native-vector-icons": "^8.1.0",
"react-native-webview": "^11.3.1",
"react-native-zohosalesiq-mobilisten": "^2.0.0",
"styled-components": "^5.2.1"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/runtime": "^7.14.0",
"@react-native-community/eslint-config": "^2.0.0",
"@types/jest": "^26.0.20",
"@types/react": "^17.0.3",
"@types/react-native": "^0.63.51",
"@types/react-test-renderer": "^17.0.1",
"babel-jest": "^26.6.3",
"eslint": "7.14.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.64.0",
"mobx-flipper": "^1.1.2",
"react-native-flipper": "^0.81.0",
"react-test-renderer": "17.0.1",
"typescript": "^4.2.3"
},
"jest": {
"preset": "react-native"
},
"prettier": {
"arrowParens": "always",
"printWidth": 100,
"semi": true,
"singleQuote": true,
"trailingComma": "all"
}
}