React Native 0.70.1 Build in debug Mode, when i try to build in release mode, I get the below error.error message.
My package.json
{
"name": "xxxxxx",
"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/native": "^6.1.1",
"#react-navigation/native-stack": "^6.9.6",
"moment": "^2.29.4",
"react": "18.1.0",
"react-native": "0.70.6",
"react-native-image-picker": "^4.10.2",
"react-native-paper": "^5.0.1",
"react-native-raw-bottom-sheet": "^2.2.0",
"react-native-safe-area-context": "^4.5.0",
"react-native-screens": "^3.18.0",
"react-native-svg": "^13.7.0",
"react-native-vector-icons": "^9.2.0",
"rtn-fetch-module": "file:RTNFetchModule"
},
"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.32.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "0.72.3",
"react-native-svg-transformer": "^1.0.0",
"react-test-renderer": "18.1.0"
},
"jest": {
"preset": "react-native"
}
}
I am trying to build react-native in release mode.
Add multidex in /android/app/build.gradle file
android {
defaultConfig {
// ...
multiDexEnabled true // <-- ADD THIS in the defaultConfig section
}
// ...
}
dependencies {
implementation 'androidx.multidex:multidex:2.0.1' // <-- ADD THIS DEPENDENCY
}
Then in android/app/src/main/java/.../MainApplication.java
// ... all your other imports here
import androidx.multidex.MultiDexApplication; // <-- ADD THIS IMPORT
// Your class definition needs `extends MultiDexApplication` like below
public class MainApplication extends MultiDexApplication implements ReactApplication {
Once added, rebuild your application: npx react-native run-android.
Related
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
}
i get no errors when i compile the APK in release but after i install it it crashes instant on load. Here are my packages:
{
"name": "etwow_rent",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"#babel/runtime": "^7.1.2",
"bundle": "^2.1.0",
"haversine": "^1.1.0",
"react": "16.5.0",
"react-native": "^0.57.1",
"react-native-camera": "^1.3.0",
"react-native-maps": "^0.22.0",
"react-native-qrcode-scanner": "^1.1.0",
"react-navigation": "^2.18.0"
},
"devDependencies": {
"babel-jest": "23.6.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.48.0",
"react-native-bundle": "0.0.4",
"react-test-renderer": "16.5.0"
},
"jest": {
"preset": "react-native"
}
}
maybe you forgot one of the steps for generating Signed APK ,Here is full Documentation of Generating Signed APK https://facebook.github.io/react-native/docs/signed-apk-android
You can go through it.
First, I created a project: react-native init project, and
when I try to import * as lightwallet from 'eth-lightwallet' in my react-native project, I get an error see this image
Found a solution at github, but this did not solve the problem for me.
My package.json:
{
"name": "androidWallet",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"asn1": "^0.2.3",
"buffer": "^5.2.0",
"eth-lightwallet": "^3.0.1",
"history": "^4.7.2",
"native-base": "^2.7.2",
"node-libs-browser": "^2.1.0",
"node-libs-react-native": "^1.0.2",
"react": "16.4.1",
"react-native": "0.55.2",
"react-native-table-component": "^1.1.8",
"react-navigation": "^2.9.3",
"react-redux": "^5.0.7",
"react-router-dom": "^4.3.1",
"react-router-redux": "^4.0.8",
"redux": "^4.0.0",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"web3": "^0.20.6"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-jest": "23.4.2",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react-native": "4",
"jest": "23.4.2",
"react-test-renderer": "16.4.1"
},
"jest": {
"preset": "react-native"
}
}
The problem is that the eth-lightwallet depends on node core modules that isn't supported by React Native out of the box. The current workaround involves using
rn-nodeify in order to provide shims for React Native to use instead. See this issue for react native and see this open issue from eth-lightwallet.
I receive this error after running ./gradlew assembleRelease:
Plugin/Preset files are not allowed to export objects, only functions.
In C:\..\node_modules\babel-preset-expo\index.js
:app:bundleReleaseJsAndAssets FAILED
**FAILURE: Build failed with an exception.**
This is what I have in package.json file:
{
"name": "Mascota24",
"version": "0.1.0",
"private": true,
"devDependencies": {
"babel-preset-stage-0": "^6.24.1",
"react-test-renderer": "16.3.1"
},
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios",
"test": "jest"
},
"jest": {
"preset": "react-native"
},
"dependencies": {
"#babel/preset-react": "^7.0.0-beta.53",
"babel-preset-env": "^1.7.0",
"babel-preset-expo": "^4.0.0",
"babel-preset-react": "^6.24.1",
"babel-preset-react-native": "^2.1.0",
"babel-preset-react-native-stage-0": "^1.0.1",
"react": "16.3.1",
"react-native": "^0.56.0",
"react-native-circle-checkbox": "^0.1.6",
"react-native-modal": "^6.4.0",
"react-native-phone-call": "^1.0.7",
"react-navigation": "^2.6.2",
"react-redux": "^5.0.7",
"redux-thunk": "^2.3.0"
}
}
And this is .babelrc file:
{
"presets": ["babel-preset-expo"],
"env": {
"development": {
"plugins": ["transform-react-jsx-source"]
}
}
}
I've followed almost every post here related with this and none of them helped me :( Thanks for any help
Thanks to #ashutosh pandey for the help, I changed react-native version to:
"react-native": "^0.55"
Then I installed redux and could generate the .apk! :D
I have a location based app built with react-native and the react-native-mapbox-gl package (MapBox Maps SDK for React Native). The app runs on both Android and IOS devices with the commands react-native run-android and react-native run-ios respectively.
When i build a production release, the .ipa and .apk files are created successfully, but they fail to install on the devices
(without any specific error messages).
Is there some extra work that i need to do for building a production release with react-native-mapbox-gl?
this is my package.json
{
"name": "MyAppName",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"#mapbox/react-native-mapbox-gl": "^6.1.1",
"babel-eslint": "^6.1.2",
"eslint": "^3.7.1",
"eslint-config-airbnb": "^12.0.0",
"eslint-plugin-import": "^1.16.0",
"eslint-plugin-jsx-a11y": "^2.2.2",
"eslint-plugin-react": "^6.3.0",
"geolib": "^2.0.24",
"mobx": "^3.1.9",
"mobx-react": "^4.1.8",
"prop-types": "^15.6.1",
"react": "16.3.1",
"react-native": "^0.54.4",
"react-native-animatable": "^1.2.4",
"react-native-keyboard-aware-scroll-view": "^0.4.4",
"react-native-modal": "^5.0.0",
"react-native-simple-toast": "0.0.8",
"react-navigation": "^1.5.2",
"tcomb-form-native": "^0.6.11"
},
"devDependencies": {
"babel-jest": "22.2.0",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-react-native": "4.0.0",
"jest": "22.2.0",
"react-test-renderer": "16.2.0"
},
"jest": {
"preset": "react-native"
},
"rnpm": {
"assets": [
"./src/assets/fonts/"
]
}
}