Expo start works but Expo build apk does not - android

I am able to run my react-native app locally using expo start --no-dev. When I try to build the APK and install it, it installs succesfully but when I run it, the app just closes and I get the android error frontend keeps stopping.
app.json
{
"name": "frontend",
"displayName": "frontend",
"expo": {
"name": "frontend",
"slug": "frontend",
"version": "1.0.0",
"assetBundlePatterns": [
"**/*"
],
"android": {
"package": "com.sri.showify",
"versionCode": 1
}
}
}
package.json
{
"main": "index.js",
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"web": "expo start --web",
"start": "react-native start",
"test": "jest"
},
"dependencies": {
"#ptomasroos/react-native-multi-slider": "^2.2.2",
"#react-native-community/async-storage": "~1.11.0",
"#react-native-community/masked-view": "0.1.10",
"#react-navigation/bottom-tabs": "^5.8.0",
"#react-navigation/drawer": "^5.9.0",
"#react-navigation/material-bottom-tabs": "^5.2.16",
"#react-navigation/native": "^5.7.3",
"#react-navigation/stack": "^5.9.0",
"axios": "^0.20.0",
"expo": "~38.0.9",
"expo-linear-gradient": "~8.2.1",
"expo-splash-screen": "^0.5.0",
"expo-status-bar": "^1.0.0",
"expo-updates": "~0.2.10",
"react": "~16.11.0",
"react-dom": "~16.11.0",
"react-native": "^0.63.2",
"react-native-animatable": "^1.3.3",
"react-native-deck-swiper": "^2.0.5",
"react-native-flags": "^1.0.0",
"react-native-gesture-handler": "~1.6.0",
"react-native-maps": "0.27.1",
"react-native-paper": "^4.1.0",
"react-native-reanimated": "~1.9.0",
"react-native-safe-area-context": "~3.0.7",
"react-native-screens": "~2.9.0",
"react-native-unimodules": "~0.10.1",
"react-native-vector-icons": "^7.1.0",
"react-native-web": "^0.13.12",
"use-state-with-callback": "^2.0.3"
},
"devDependencies": {
"#babel/core": "~7.9.0",
"babel-jest": "~25.2.6",
"jest": "~25.2.6",
"react-test-renderer": "~16.11.0"
},
"jest": {
"preset": "react-native"
},
"private": true
}

Related

Expo eas build apk crashes on real device but work on expo go

Everything runs normally while testing with the emulator in development env but when i built my expo app to get an apk with this command eas build -p android --profile preview.
After i installed the apk on a real device it instantly crashes.
But if i run it on expo go, it runs normally.
Here is my package.json
{
"name": "myapp",
"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"
},
"dependencies": {
"#react-native-firebase/app": "^16.4.6",
"#react-native-firebase/messaging": "^16.4.6",
"#react-native-picker/picker": "^2.4.8",
"#react-navigation/drawer": "^6.5.3",
"#react-navigation/native": "^6.0.16",
"#react-navigation/stack": "^6.3.7",
"#reduxjs/toolkit": "^1.9.1",
"email-validator": "^2.0.4",
"expo": "~47.0.8",
"expo-dev-client": "~2.0.1",
"expo-device": "~5.0.0",
"expo-image-picker": "~14.0.2",
"expo-notifications": "~0.17.0",
"expo-status-bar": "~1.4.2",
"expo-updates": "~0.15.6",
"firebase": "^9.6.7",
"formik": "^2.2.9",
"react": "18.1.0",
"react-native": "0.70.5",
"react-native-gesture-handler": "~2.8.0",
"react-native-modal-datetime-picker": "^14.0.0",
"react-native-reanimated": "^2.12.0",
"react-native-safe-area-context": "^4.4.1",
"react-native-screens": "~3.18.0",
"react-native-toast-message": "^2.1.5",
"react-redux": "^8.0.5",
"redux": "^4.2.0",
"redux-thunk": "^2.4.2",
"yup": "^0.32.11"
},
"devDependencies": {
"#babel/core": "^7.12.9"
},
"private": true
}
And here is my eas.json
{
"cli": {
"version": ">= 2.6.0"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"distribution": "internal",
"android": {
"buildType": "apk"
}
},
"preview2": {
"android": {
"gradleCommand": ":app:assembleRelease"
}
},
"production": {}
},
"submit": {
"production": {}
}
}

Expo error Unexpected token '{'. import call expects exactly one argument

It was working fine until I installed some packages with --legacy-peer-deps. then I uninstalled those packages but the error remained
my package.json:
{
"name": "nativefetchdemo",
"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",
"eject": "expo eject"
},
"dependencies": {
"#react-native-async-storage/async-storage": "^1.17.7",
"#react-native-community/masked-view": "^0.1.11",
"#react-native-material/core": "^1.3.7",
"#react-navigation/native": "^6.0.11",
"#react-navigation/stack": "^6.2.2",
"axios": "^0.27.2",
"expo": "~45.0.0",
"expo-build-properties": "~0.2.0",
"expo-device": "~4.2.0",
"expo-notifications": "~0.15.4",
"expo-permissions": "~13.2.0",
"expo-status-bar": "~1.3.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-native": "0.68.2",
"react-native-gesture-handler": "~2.2.1",
"react-native-paper": "^4.12.4",
"react-native-reanimated": "~2.8.0",
"react-native-safe-area-context": "4.2.4",
"react-native-screens": "~3.11.1",
"react-native-svg-transformer": "^1.0.0",
"react-native-web": "0.17.7",
"react-redux": "^8.0.2",
"redux": "^4.2.0",
"redux-devtools-extension": "^2.13.9",
"redux-logger": "^3.0.6",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.4.1",
"tailwindcss-react-native": "^1.7.10",
"twrnc": "^3.3.3"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"tailwindcss": "^3.1.8"
},
"private": true
}
I installed the packages which made this error appear. It was fine when only the current packages were there. but now the error won' go away.
Idk if it caused it but I used --legacy-peer-deps command line when installing packages because some packages had different versions of react
my babel.config.js:
module.exports = function (api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
plugins: [
'tailwindcss-react-native/babel',
'react-native-reanimated/plugin',
],
env: {
production: {
plugins: ['react-native-paper/babel', 'react-native-reanimated/plugin'],
},
},
};
};

Raise error after reload android app on React-native

When I run the app via "expo run:android" the app starts, but if I close the app in the emulator and try to run it again, I get 2 errors:
Screen native module hasn't been linked. Please check the react-native-screens README for more details
and
Invariant Violation: requireNativeComponent: "RNSScreenStackHeaderConfig" was not found in the UIManager.
Is this normal behavior or am I missing something?
My package.json
{
"name": "mwproductivity",
"version": "1.0.0",
"scripts": {
"start": "expo start --dev-client",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web"
},
"dependencies": {
"#expo/webpack-config": "^0.17.0",
"#react-native-community/masked-view": "^0.1.11",
"#react-navigation/native": "^6.0.13",
"#react-navigation/native-stack": "^6.9.1",
"#reduxjs/toolkit": "^1.8.6",
"expo": "~46.0.16",
"expo-splash-screen": "~0.16.2",
"expo-status-bar": "~1.4.0",
"react": "18.0.0",
"react-dom": "18.0.0",
"react-native": "0.69.6",
"react-native-gesture-handler": "^2.7.1",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-reanimated": "^2.11.0",
"react-native-safe-area-context": "^4.4.1",
"react-native-screens": "^3.18.2",
"react-native-sqlite-storage": "^6.0.1",
"react-native-web": "~0.18.7",
"react-redux": "^8.0.4",
"styled-components": "^5.3.6"
},
"devDependencies": {
"#babel/core": "^7.12.9"
},
"private": true
}

React native apk release issue

I am new in react-native. I created one app it was working fine on local but when i run the release APK the app crash on change screen/navigate to another screen.
I have tried for days now to resolve this without success. Im not really sure what is causing this issue as when i run the debug version the app works fine no issues.
As soon as i open the installed signed APK the app crashes.
I am using the below packages.
{ "name": "testAPP", "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": {
"#react-navigation/bottom-tabs": "^6.0.9",
"#react-navigation/drawer": "^6.1.8",
"#react-navigation/material-top-tabs": "^6.0.6",
"#react-navigation/native": "^6.0.6",
"#react-navigation/native-stack": "^6.2.5",
"axios": "^0.24.0",
"react": "17.0.2",
"react-native": "0.66.4",
"react-native-auth0": "^2.11.0",
"react-native-elements": "^3.4.2",
"react-native-gesture-handler": "^2.1.1",
"react-native-gifted-chat": "^0.16.3",
"react-native-linear-gradient": "^2.5.6",
"react-native-pager-view": "^5.4.9",
"react-native-paper": "^4.11.1",
"react-native-raw-bottom-sheet": "^2.2.0",
"react-native-reanimated": "^2.2.4",
"react-native-safe-area-context": "^3.3.2",
"react-native-screens": "^3.10.1",
"react-native-simple-modal": "^9.0.1",
"react-native-svg": "^12.1.1",
"react-native-svg-transformer": "^1.0.0",
"react-native-tab-view": "^3.1.1",
"react-native-vector-icons": "^9.0.0",
"react-redux": "^7.2.6",
"redux": "^4.1.2",
"redux-thunk": "^2.4.1"
},
"devDependencies": {
"#babel/core": "7.16.7",
"#babel/runtime": "7.16.7",
"#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-test-renderer": "17.0.2"
},
"jest": {
"preset": "react-native",
"setupFiles": [
"./node_modules/react-native-gesture-handler/jestSetup.js"
]
}
}

While Debug mode, its working perfectly but in release APK it gives error

I have developed a react-native app for internal usage. In the Debug mode, it's working without any error and gesture is also working fine. But in release APK with self-signed Keystore its shows some error. When the Drawer and tab components are called it stopped working.
"name": "AnnaIndustry",
"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": {
"#react-native-community/async-storage": "^1.6.2",
"#react-native-community/datetimepicker": "^2.1.0",
"#react-native-community/viewpager": "^2.0.0",
"autoresponsive-react-native": "^1.0.9",
"axios": "^0.19.0",
"native-base": "^2.13.8",
"prop-types": "^15.7.2",
"react": "16.9.0",
"react-native": "0.61.2",
"react-native-gesture-handler": "^1.4.1",
"react-native-image-picker": "^1.1.0",
"react-native-linear-gradient": "^2.5.6",
"react-native-reanimated": "^1.3.0",
"react-native-screens": "^2.0.0-alpha.3",
"react-native-swiper": "^1.5.14",
"react-native-vector-icons": "^6.6.0",
"react-navigation": "^4.0.10",
"react-navigation-drawer": "^2.2.2",
"react-navigation-material-bottom-tabs": "^2.1.2",
"react-navigation-stack": "^1.9.3",
"react-navigation-tabs": "^2.5.5",
"react-redux": "^7.1.1",
"redux": "^4.0.4",
"redux-logger": "^3.0.6",
"redux-promise-middleware": "^6.1.1",
"redux-thunk": "^2.3.0"
},
"devDependencies": {
"#babel/core": "7.6.2",
"#babel/runtime": "7.6.2",
"#react-native-community/eslint-config": "0.0.3",
"babel-jest": "24.9.0",
"eslint": "6.5.1",
"jest": "24.9.0",
"metro-react-native-babel-preset": "0.51.1",
"react-test-renderer": "16.9.0"
},
"jest": {
"preset": "react-native"
}
}
These are the libraries I used in my code

Categories

Resources