I'm having trouble starting my React Native app build with Expo.
This issue is occurring in the Run Gradlew phase, returning the following errors:
w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
Execution optimizations have been disabled for 7 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.
536 actionable tasks: 536 executed
[stderr] FAILURE: Build completed with 2 failures.
[stderr] 1: Task failed with an exception.
[stderr] -----------
[stderr] * What went wrong:
[stderr] Execution failed for task ':app:collectReleaseDependencies'.
[stderr] > java.io.FileNotFoundException: / (Is a directory)
[stderr] * Try:
[stderr] > Run with --stacktrace option to get the stack trace.
[stderr] > Run with --info or --debug option to get more log output.
[stderr] > Run with --scan to get full insights.
[stderr] ==============================================================================
[stderr] 2: Task failed with an exception.
[stderr] -----------
[stderr] * What went wrong:
[stderr] java.lang.StackOverflowError (no error message)
[stderr] * Try:
[stderr] > Run with --stacktrace option to get the stack trace.
[stderr] > Run with --info or --debug option to get more log output.
[stderr] > Run with --scan to get full insights.
[stderr] ==============================================================================
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 7m 44s
Here is my package.json:
{
"name": "app-name",
"version": "1.0.1",
"main": "index.js",
"scripts": {
"start": "expo start --dev-client",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web"
},
"dependencies": {
"#expo-google-fonts/spartan": "^0.2.2",
"#react-native-community/netinfo": "^9.3.5",
"#react-navigation/bottom-tabs": "^6.3.1",
"#react-navigation/native": "^6.0.10",
"#react-navigation/stack": "^6.2.1",
"#rneui/base": "^4.0.0-rc.4",
"#rneui/themed": "^4.0.0-rc.4",
"axios": "^0.27.2",
"expo": "~46.0.19",
"expo-document-picker": "~10.3.0",
"expo-file-system": "~14.1.0",
"expo-font": "~10.2.0",
"expo-navigation-bar": "~1.3.0",
"expo-splash-screen": "~0.16.2",
"expo-status-bar": "~1.4.0",
"expo-updates": "~0.14.7",
"firebase": "9.8.3",
"react": "18.0.0",
"react-dom": "18.0.0",
"react-native": "0.69.6",
"react-native-bouncy-checkbox": "^2.1.10",
"react-native-bouncy-checkbox-group": "^0.1.0",
"react-native-dotenv": "^3.3.1",
"react-native-dropdown-select-list": "^1.0.18",
"react-native-elements": "^3.4.2",
"react-native-gesture-handler": "~2.5.0",
"react-native-maps": "^1.3.2",
"react-native-modal": "^13.0.1",
"react-native-permissions": "^3.3.1",
"react-native-reanimated": "~2.9.1",
"react-native-safe-area-context": "4.3.1",
"react-native-screens": "^3.18.2",
"react-native-status-bar-height": "^2.6.0",
"react-native-svg": "12.3.0",
"react-native-svg-transformer": "^1.0.0",
"react-native-swiper": "^1.6.0",
"react-native-vector-icons": "^9.1.0",
"react-native-web": "~0.18.7",
"styled-components": "^5.3.5",
"xlsx": "^0.18.5"
},
"devDependencies": {
"#babel/core": "^7.18.6",
"metro-react-native-babel-preset": "^0.70.3",
"react-test-renderer": "18.0.0"
},
"private": true
}
My eas.json:
{
"cli": {
"version": ">= 3.6.0"
},
"build": {
"development": {
"distribution": "internal",
"android": {
"gradleCommand": ":app:assembleDebug"
},
"ios": {
"buildConfiguration": "Debug",
"resourceClass": "m1-medium"
}
},
"preview": {
"distribution": "internal",
"ios": {
"resourceClass": "m1-medium"
}
},
"production": {
"ios": {
"resourceClass": "m1-medium"
}
}
},
"submit": {
"production": {}
}
}
My app.json:
{
"expo": {
"name": "App Name",
"slug": "appname",
"version": "1.0.1",
"icon": "./assets/images/icon.png",
"splash": {
"image": "./assets/images/splash.png",
"resizeMode": "contain",
"backgroundColor": "#FF6B0F"
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/images/adaptive-icon.png",
"backgroundColor": "#fff"
},
"permissions": [
"WRITE_EXTERNAL_STORAGE"
],
"package": "com.euquero.app"
},
"assetBundlePatterns": [
"**/*"
],
"packagerOpts": {
"config": "metro.config.js",
"sourceExts": [
"js",
"svg"
]
},
"description": "",
"extra": {
"eas": {
"projectId": "24bced36-2rfs-4d11-89e2-19013e1f178f"
}
}
}
}
I've tried using the expo upgrade to update everything, I've used the react native upgrade helper to update correctly. I've already tried clearing Gradlew's cache (./gradlew clean).
I already updated the build.gradlew.
I managed to solve it, deleted the Android folder and Ios, also deleted the Node Modules, used the 'yarn' command, used the 'eas build:configure' command, then 'npx expo prebuild' and finally 'eas build --clear- cache'.
Related
I am working in a old react native project. I am getting errors while running this app. How I can solve these errors. First time I am working in a old react native project. This app build in react native old version. I update this in to version. Please help me.
// My package.json ==>
"name": "unknown",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "react-native start",
"flow": "flow --show-all-errors",
"flow start": "flow start",
"flow stop": "flow stop",
"flow status": "flow status",
"flow coverage": "flow coverage",
"eslint": "eslint",
"eslint-check": "eslint --print-config .eslintrc.js | eslint-config-prettier-check",
"build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'"
},
"dependencies": {
"#react-native-community/cli-platform-android": "^9.1.0",
"babel-plugin-transform-remove-console": "6.9.4",
"braces": "^2.3.2",
"crypto-js": "4.1.1",
"currency-formatter": "1.5.9",
"d3": "7.3.0",
"d3-array": "3.1.1",
"d3-scale": "4.0.2",
"d3-shape": "3.1.0",
"moment": "^2.29.4",
"react": "^17.0.2",
"react-dom": "^18.2.0",
"react-native": "^0.69.5",
"react-native-appstore-version-checker": "3.0.0",
"react-native-device-info": "^10.1.1",
"react-native-dropdownalert": "4.5.1",
"react-native-elements": "3.4.2",
"react-native-fabric": "^0.5.2",
"react-native-fingerprint-scanner": "6.0.0",
"react-native-gesture-handler": "^2.6.0",
"react-native-keychain": "8.0.0",
"react-native-loading-spinner-overlay": "3.0.0",
"react-native-maps": "0.30.1",
"react-native-modal-datetime-picker": "13.0.1",
"react-native-pathjs-charts": "0.0.30",
"react-native-segmented-control-tab": "4.0.0",
"react-native-sentry": "0.43.2",
"react-native-simple-dialogs": "1.4.0",
"react-native-svg": "12.3.0",
"react-native-table-component": "1.2.2",
"react-native-vector-icons": "9.1.0",
"react-navigation": "4.4.4",
"react-redux": "7.2.6",
"realm": "10.13.0",
"redux": "4.1.2",
"redux-logger": "3.0.6",
"redux-thunk": "2.4.1"
},
"devDependencies": {
"#babel/core": "7.17.5",
"#babel/plugin-proposal-class-properties": "7.16.7",
"#babel/plugin-transform-runtime": "7.17.0",
"#babel/preset-env": "7.16.11",
"#babel/preset-react": "7.16.7",
"babel-cli": "6.26.0",
"babel-eslint": "10.1.0",
"babel-jest": "27.5.1",
"babel-plugin-module-resolver": "4.1.0",
"babel-preset-flow": "6.23.0",
"babel-preset-react-native": "2.1.0",
"eslint": "8.10.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "8.5.0",
"eslint-import-resolver-babel-module": "5.3.1",
"eslint-plugin-import": "2.25.4",
"eslint-plugin-jsx-a11y": "6.5.1",
"eslint-plugin-react": "7.29.3",
"flow-bin": "0.173.0",
"invariant": "2.2.4",
"jest": "27.5.1",
"metro-react-native-babel-preset": "0.69.0",
"react-test-renderer": "17.0.2"
},
"jest": {
"preset": "react-native"
},
"rnpm": {
"assets": [
"./assets/fonts/"
]
}
}
//project level gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.1'
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
//My gradle.app file ==>
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:'
}
}
apply plugin: "com.android.application"
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
google()
}
When I try to run android app getting this below error->
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:mergeDebugAssets'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not resolve project :realm.
Required by:
project :app
> No matching configuration of project :realm was found. The consumer was configured to find a runtime of a component, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '7.2.1' but:
- None of the consumable configurations have attributes.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
I get this weird message in android emulator whilst running expo, any idea whats causing this? There seems to be no real stack trace. If I run in debug mode, it works fine which is odd. There's definitely enough space on the hard disk so don't think that's an issue either.
Package.json
{
"name": "project",
"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": {
"#expo-google-fonts/kanit": "^0.2.2",
"#expo-google-fonts/oxanium": "^0.2.2",
"#fortawesome/fontawesome-svg-core": "^6.1.1",
"#fortawesome/free-solid-svg-icons": "^6.1.1",
"#fortawesome/react-native-fontawesome": "^0.3.0",
"#react-navigation/drawer": "^6.4.3",
"#react-navigation/native": "^6.0.11",
"#react-navigation/native-stack": "^6.7.0",
"axios": "^0.27.2",
"expo": "^46.0.0",
"expo-status-bar": "~1.4.0",
"react": "18.0.0",
"react-dom": "18.0.0",
"react-native": "0.69.4",
"react-native-dotenv": "^3.3.1",
"react-native-reanimated": "~2.9.1",
"react-native-safe-area-context": "4.3.1",
"react-native-screens": "~3.15.0",
"react-native-svg": "12.3.0",
"react-native-web": "~0.18.7",
"react-native-webview": "11.23.0",
"react-native-youtube-iframe": "^2.2.2"
},
"devDependencies": {
"#babel/core": "^7.18.6",
"#babel/preset-react": "^7.18.6",
"eslint": "^8.19.0",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-native": "^4.0.0"
},
"private": true
}
babel.config.js
module.exports = function(api) {
api.cache(true);
return {
presets: [
'babel-preset-expo'
],
plugins: [
'react-native-reanimated/plugin',
'module:react-native-dotenv'
]
};
};
Found the solution. You have to run the emulator without Android Studio (ie. from the command line)
In Windows:
cd C:\Users\%USERNAME%\AppData\Local\Android\Sdk\emulator
emulator -avd Pixel_5_API_30
Of course, switch 'Pixel_5_API_30' with the name of the emulator listed in Android Studio.
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
Following is the error which I receive when I try to run project.
I tried restarting server several times. Even unable to install new modules. (tried installing prop-types)
The development server returned response error code: 500
URL: http://10.0.3.2:8088/index.android.bundle?platform=android&dev=true&hot=false&minify=false
Body: {"from":"C:\\Users\\user\\Desktop\\NewRNPro\\node_modules\\react\\cjs\\react.production.min.js","to":"prop-types","message":"Unable to resolve module `prop-types` from `C:\\Users\\user\\Desktop\\NewRNPro\\node_modules\\react\\cjs\\react.production.min.js`: Module does not exist in the module map or in these directories:\n C:\\Users\\user\\Desktop\\node_modules\n\nThis might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:\n 1. Clear watchman watches: `watchman watch-del-all`.\n 2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.\n 3. Reset packager cache: `rm -fr $TMPDIR/react-*` or `npm start --
--reset-cache`.","name":"UnableToResolveError","type":"UnableToResolveError","errors":[{}]} processBundleResult
BundleDownloader.java:170 access$100
BundleDownloader.java:39 onResponse
BundleDownloader.java:139 execute
RealCall.java:135 run
NamedRunnable.java:32 runWorker
ThreadPoolExecutor.java:1113 run
ThreadPoolExecutor.java:588 run
Thread.java:818
package.json
{
"name": "NewRNPro",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"lottie-react-native": "^2.2.0",
"react": "16.0.0-alpha.12",
"react-native": "0.47.1",
"react-native-collapsible": "^0.9.0",
"react-native-drawer": "^2.3.0",
"react-native-drawer-menu": "^0.2.4",
"react-native-elements": "^0.16.0",
"react-native-gridview": "^0.1.1",
"react-native-image-slider": "^1.1.5",
"react-native-scrollable-tab-view": "^0.6.7",
"react-native-snackbar": "^0.4.3",
"react-native-sqlite-storage": "^3.3.3",
"react-native-vector-icons": "^4.3.0",
"react-navigation": "^1.0.0-beta.11",
"react-redux": "^5.0.6"
},
"devDependencies": {
"babel-jest": "20.0.3",
"babel-preset-react-native": "2.1.0",
"jest": "20.0.4",
"react-test-renderer": "16.0.0-alpha.12"
},
"jest": {
"preset": "react-native"
}
}
Hi i have been trying to run 'npm test' faced a couple of issues like this with native-base but resolved by placing 'native-base-shoutem-theme|||tcomb-form-native' in transformIgnorePatterns key in my Package.json file.
but haven't found a solution with react-native-vector-icons as shown below
myapp#0.0.1 test D:\ReactWorkSpace\myapp
jest
PASS tests\index.ios.js
FAIL tests\index.android.js
● Test suite failed to run
D:\ReactWorkSpace\myapp\node_modules\native-base\node_modules\react-native-vector-icons\Ionicons.js:6
import createIconSet from './lib/create-icon-set';
^^^^^^
SyntaxError: Unexpected token import
at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/ScriptTransformer.js:289:17)
at Object.<anonymous> (node_modules/native-base/dist/src/basic/IconNB.js:5:15)
at Object.<anonymous> (node_modules/native-base/dist/src/index.js:16:13)
Test Suites: 1 failed, 1 passed, 2 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 3.189s, estimated 8s
Ran all test suites.
npm ERR! Test failed. See above for more details
my package.json file is
{
"name": "myapp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"js-base64": "^2.1.9",
"moment": "^2.18.1",
"native-base": "^2.2.1",
"react": "16.0.0-alpha.12",
"react-native": "0.46.0",
"react-native-animatable": "^1.2.2",
"react-native-button": "^2.0.0",
"react-native-drawer": "^2.3.0",
"react-native-linear-gradient": "^2.2.0",
"react-native-material-design": "^0.3.7",
"react-native-material-kit": "^0.4.1",
"react-native-material-ui": "^1.12.0",
"react-native-vector-icons": "^4.2.0",
"react-navigation": "^1.0.0-beta.11",
"react-toolbox": "^2.0.0-beta.12",
"render-if": "^0.1.1"
},
"devDependencies": {
"babel-jest": "20.0.3",
"babel-preset-react-native": "2.1.0",
"jest": "^20.0.4",
"react-test-renderer": "16.0.0-alpha.12"
},
"jest": {
"preset": "react-native",
"transformIgnorePatterns": [
"node_modules/(?!react-native|native-base-shoutem-theme|#shoutem/animation|#shoutem/ui|tcomb-form-native)"
]
}
}
Add this to your package.json. It solves your problem :)
"jest": {
"preset": "react-native",
"transformIgnorePatterns": [
"/node_modules/(?!native-base)/"
],
...
}