Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@react-native-community/cli-platform-android Build failed with an exception #838

Closed
b1ngx opened this issue Nov 7, 2019 · 58 comments
Closed
Assignees

Comments

@b1ngx
Copy link

b1ngx commented Nov 7, 2019

Environment

react-native info

yarn run v1.19.1
$ /Users/b1ng/rn/haokan/node_modules/.bin/react-native info
info Fetching system and libraries information...
System:
    OS: macOS 10.15.1
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
    Memory: 53.23 MB / 8.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.12.0 
    Yarn: 1.19.1 
    npm: 6.12.1 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5900203
    Xcode: /undefined - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0
    react-native: 0.61.4 => 0.61.4
✨  Done in 2.66s.

react-native --version

yarn run v1.19.1
$ /Users/b1ng/rn/haokan/node_modules/.bin/react-native --version
3.0.0-alpha.7
✨  Done in 0.32s.

Description

yarn android

yarn run v1.19.1
$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 864 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
info Installing the app...

FAILURE: Build failed with an exception.

* Where:
Script '/Users/b1ng/rn/haokan/node_modules/@react-native-community/cli-platform-android/native_modules.gradle' line: 182

* What went wrong:
A problem occurred evaluating script.
> Unable to determine the current character, it is not a string, number, array, or object

  The current character read is 'i' with an int value of 105
  Unable to determine the current character, it is not a string, number, array, or object
  line number 1
  index number 0
  info Run "react-native --help" to see a list of all available commands.
  ^

* 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

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* Where:
Script '/Users/b1ng/rn/haokan/node_modules/@react-native-community/cli-platform-android/native_modules.gradle' line: 182

* What went wrong:
A problem occurred evaluating script.
> Unable to determine the current character, it is not a string, number, array, or object

  The current character read is 'i' with an int value of 105
  Unable to determine the current character, it is not a string, number, array, or object
  line number 1
  index number 0
  info Run "react-native --help" to see a list of all available commands.
  ^

* 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

    at checkExecSyncError (child_process.js:621:11)
    at execFileSync (child_process.js:639:15)
    at runOnAllDevices (/Users/b1ng/rn/haokan/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)
    at buildAndRun (/Users/b1ng/rn/haokan/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:158:41)
    at /Users/b1ng/rn/haokan/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:125:12
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Command.handleAction (/Users/b1ng/rn/haokan/node_modules/@react-native-community/cli/build/index.js:164:9)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Reproducible Demo

@Esemesek
Copy link
Member

Esemesek commented Nov 7, 2019

It seems like you have global react-native-cli installed, which causes name conflicts in react-native binary. Could you please remove global react-native-cli by running yarn global remove react-native-cli and try again with yarn react-native run-android?

@thymikee
Copy link
Member

thymikee commented Nov 7, 2019

@Esemesek since we call npx, it's npm records we want to update, so running

npm uninstall -g react-native-cli

seems more appropriate.

@b1ngx
Copy link
Author

b1ngx commented Nov 8, 2019

@Esemesek

I haven't install react-native-cli any all. Create the app with npx react-native init.
And when i reinstall @react-native-community/cli-platform-android with @3.0.0-alpha.2 , it's ok.

@grabbou
Copy link
Member

grabbou commented Nov 15, 2019

Can you please run yarn react-native config and paste the output? It's interesting, because on master, line 182 contains nothing but a function declaration.

I would recommend upgrading to "just released" version 3.0.0 and pasting the output again. The line should be different and we can debug this further.

@b1ngx
Copy link
Author

b1ngx commented Nov 19, 2019

I create the project use command npx react-native init test

yarn react-native config

yarn run v1.19.1
$ /Users/b1ng/rn/test/node_modules/.bin/react-native config
{
  "root": "/Users/b1ng/rn/test",
  "reactNativePath": "/Users/b1ng/rn/test/node_modules/react-native",
  "dependencies": {},
  "commands": [
    {
      "name": "log-ios",
      "description": "starts iOS device syslog tail"
    },
    {
      "name": "run-ios",
      "description": "builds your app and starts it on iOS simulator",
      "examples": [
        {
          "desc": "Run on a different simulator, e.g. iPhone 5",
          "cmd": "react-native run-ios --simulator \"iPhone 5\""
        },
        {
          "desc": "Pass a non-standard location of iOS directory",
          "cmd": "react-native run-ios --project-path \"./app/ios\""
        },
        {
          "desc": "Run on a connected device, e.g. Max's iPhone",
          "cmd": "react-native run-ios --device \"Max's iPhone\""
        },
        {
          "desc": "Run on the AppleTV simulator",
          "cmd": "react-native run-ios --simulator \"Apple TV\"  --scheme \"helloworld-tvOS\""
        }
      ],
      "options": [
        {
          "name": "--simulator [string]",
          "description": "Explicitly set simulator to use. Optionally include iOS version betweenparenthesis at the end to match an exact version: \"iPhone 6 (10.0)\"",
          "default": "iPhone 11"
        },
        {
          "name": "--configuration [string]",
          "description": "Explicitly set the scheme configuration to use",
          "default": "Debug"
        },
        {
          "name": "--scheme [string]",
          "description": "Explicitly set Xcode scheme to use"
        },
        {
          "name": "--project-path [string]",
          "description": "Path relative to project root where the Xcode project (.xcodeproj) lives.",
          "default": "ios"
        },
        {
          "name": "--device [string]",
          "description": "Explicitly set device to use by name.  The value is not required if you have a single device connected."
        },
        {
          "name": "--udid [string]",
          "description": "Explicitly set device to use by udid"
        },
        {
          "name": "--no-packager",
          "description": "Do not launch packager while building"
        },
        {
          "name": "--verbose",
          "description": "Do not use xcpretty even if installed"
        },
        {
          "name": "--port [number]",
          "default": 8081
        },
        {
          "name": "--terminal [string]",
          "description": "Launches the Metro Bundler in a new window using the specified terminal path."
        }
      ]
    },
    {
      "name": "log-android",
      "description": "starts logkitty"
    },
    {
      "name": "run-android",
      "description": "builds your app and starts it on a connected Android emulator or device",
      "options": [
        {
          "name": "--root [string]",
          "description": "Override the root directory for the android build (which contains the android directory)",
          "default": ""
        },
        {
          "name": "--variant [string]",
          "description": "Specify your app's build variant",
          "default": "debug"
        },
        {
          "name": "--appFolder [string]",
          "description": "Specify a different application folder name for the android source. If not, we assume is \"app\"",
          "default": "app"
        },
        {
          "name": "--appId [string]",
          "description": "Specify an applicationId to launch after build.",
          "default": ""
        },
        {
          "name": "--appIdSuffix [string]",
          "description": "Specify an applicationIdSuffix to launch after build.",
          "default": ""
        },
        {
          "name": "--main-activity [string]",
          "description": "Name of the activity to start",
          "default": "MainActivity"
        },
        {
          "name": "--deviceId [string]",
          "description": "builds your app and starts it on a specific device/simulator with the given device id (listed by running \"adb devices\" on the command line)."
        },
        {
          "name": "--no-packager",
          "description": "Do not launch packager while building"
        },
        {
          "name": "--port [number]",
          "default": 8081
        },
        {
          "name": "--terminal [string]",
          "description": "Launches the Metro Bundler in a new window using the specified terminal path.",
          "default": "iTerm.app"
        },
        {
          "name": "--tasks [list]",
          "description": "Run custom Gradle tasks. By default it's \"installDebug\""
        },
        {
          "name": "--no-jetifier",
          "description": "Do not run \"jetifier\" – the AndroidX transition tool. By default it runs before Gradle to ease working with libraries that don't support AndroidX yet. See more at: https://www.npmjs.com/package/jetifier.",
          "default": false
        }
      ]
    }
  ],
  "assets": [],
  "platforms": {
    "ios": {},
    "android": {}
  },
  "haste": {
    "providesModuleNodeModules": [
      "react-native"
    ],
    "platforms": [
      "ios",
      "android"
    ]
  },
  "project": {
    "ios": {
      "sourceDir": "/Users/b1ng/rn/test/ios",
      "folder": "/Users/b1ng/rn/test",
      "pbxprojPath": "/Users/b1ng/rn/test/ios/test.xcodeproj/project.pbxproj",
      "podfile": "/Users/b1ng/rn/test/ios/Podfile",
      "podspecPath": null,
      "projectPath": "/Users/b1ng/rn/test/ios/test.xcodeproj",
      "projectName": "test.xcodeproj",
      "libraryFolder": "Libraries",
      "sharedLibraries": [],
      "plist": [],
      "scriptPhases": []
    },
    "android": {
      "sourceDir": "/Users/b1ng/rn/test/android/app",
      "isFlat": false,
      "folder": "/Users/b1ng/rn/test",
      "stringsPath": "/Users/b1ng/rn/test/android/app/src/main/res/values/strings.xml",
      "manifestPath": "/Users/b1ng/rn/test/android/app/src/main/AndroidManifest.xml",
      "buildGradlePath": "/Users/b1ng/rn/test/android/app/build.gradle",
      "settingsGradlePath": "/Users/b1ng/rn/test/android/settings.gradle",
      "assetsPath": "/Users/b1ng/rn/test/android/app/src/main/assets",
      "mainFilePath": "/Users/b1ng/rn/test/android/app/src/main/java/com/test/MainApplication.java",
      "packageName": "com.test"
    }
  }
}
✨  Done in 0.96s.

yarn android

yarn run v1.19.1
$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 864 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
info Installing the app...
Starting a Gradle Daemon (subsequent builds will be faster)
:ReactNative:Failed to parse React Native CLI configuration: groovy.json.JsonException: Unable to determine the current character, it is not a string, number, array, or object

The current character read is 'i' with an int value of 105
Unable to determine the current character, it is not a string, number, array, or object
line number 1
index number 0
info Run "react-native --help" to see a list of all available commands.
^

FAILURE: Build failed with an exception.

* Where:
Script '/Users/b1ng/rn/test/node_modules/@react-native-community/cli-platform-android/native_modules.gradle' line: 200

* What went wrong:
A problem occurred evaluating script.
> Failed to parse React Native CLI configuration. Expected running 'npx --quiet --no-install react-native config' command from '/Users/b1ng/rn/test' directory to output valid JSON, but it didn't. This may be caused by npx resolving to a legacy global react-native binary. Please make sure to uninstall any global 'react-native' binaries: 'npm uninstall -g react-native react-native-cli' and try again

* 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 7s

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
:ReactNative:Failed to parse React Native CLI configuration: groovy.json.JsonException: Unable to determine the current character, it is not a string, number, array, or object

The current character read is 'i' with an int value of 105
Unable to determine the current character, it is not a string, number, array, or object
line number 1
index number 0
info Run "react-native --help" to see a list of all available commands.
^

FAILURE: Build failed with an exception.

* Where:
Script '/Users/b1ng/rn/test/node_modules/@react-native-community/cli-platform-android/native_modules.gradle' line: 200

* What went wrong:
A problem occurred evaluating script.
> Failed to parse React Native CLI configuration. Expected running 'npx --quiet --no-install react-native config' command from '/Users/b1ng/rn/test' directory to output valid JSON, but it didn't. This may be caused by npx resolving to a legacy global react-native binary. Please make sure to uninstall any global 'react-native' binaries: 'npm uninstall -g react-native react-native-cli' and try again

* 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 7s

    at checkExecSyncError (child_process.js:603:11)
    at execFileSync (child_process.js:621:15)
    at runOnAllDevices (/Users/b1ng/rn/test/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)
    at buildAndRun (/Users/b1ng/rn/test/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:158:41)
    at /Users/b1ng/rn/test/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:125:12
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Command.handleAction (/Users/b1ng/rn/test/node_modules/@react-native-community/cli/build/index.js:164:9)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@thymikee
Copy link
Member

Have you seen the error message?

Failed to parse React Native CLI configuration. Expected running 'npx --quiet --no-install react-native config' command from '/Users/b1ng/rn/test' directory to output valid JSON, but it didn't. This may be caused by npx resolving to a legacy global react-native binary. Please make sure to uninstall any global 'react-native' binaries: 'npm uninstall -g react-native react-native-cli' and try again

@b1ngx
Copy link
Author

b1ngx commented Nov 20, 2019

I did not install react-native and react-native-cli , and i also run npm uninstall -g react-native react-native-cli

When remove the native_modules.gradle comment /* dir */

def reactNativeConfigOutput = this.getCommandOutput(command, /* dir */) 

to

def reactNativeConfigOutput = this.getCommandOutput(command, dir)

it's ok.

@bneigher
Copy link

I am seeing this after upgrading to 0.61.4 react-native. I've never installed react-native or react-native-cli globally. Commenting back in the 2nd argument here didn't change it for me

@grabbou
Copy link
Member

grabbou commented Nov 24, 2019

Looks like the JSON is invalid and react-native config works w/o issues here. So, to verify, could you run npx --quiet --no-install react-native config yourself and tell us what's the output? The CLI clearly has issues parsing the configuration.

@sibelius
Copy link
Member

I've solved like this on native_modules.gradle

- def command = "${npx} --quiet --no-install react-native config"
+ def command = "yarn --silent react-native config"
` ``

@b1ngx b1ngx changed the title @react-native-community/cli-platform-android@3.0.0-alpha.7 build failed with an exception @react-native-community/cli-platform-android Build failed with an exception Nov 27, 2019
@rvgroup
Copy link

rvgroup commented Nov 27, 2019

Try updating the Node to the version 10.17.0. It helped me.

@grabbou grabbou self-assigned this Nov 28, 2019
@grabbou
Copy link
Member

grabbou commented Nov 28, 2019

@sibelius thanks! I remember @thymikee was saying --quiet mode did have its issues while running with npx. I will look into it this week.

@sibelius
Copy link
Member

another problem with npx that we can have mismatch version of react-native if you have many different projects in different react-native versions

@sagargulati
Copy link

sagargulati commented Dec 5, 2019

Any fix for this?

C:\Users\Sagar\Apps\react\gameapp>npx react-native info
info Fetching system and libraries information...
System:
    OS: Windows 10 10.0.17134
    CPU: (4) x64 Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
    Memory: 4.37 GB / 11.88 GB
  Binaries:
    Node: 13.3.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.19.0 - C:\Users\Sagar\AppData\Roaming\npm\yarn.CMD
    npm: 6.13.1 - C:\Users\Sagar\AppData\Roaming\npm\npm.CMD
  SDKs:
    Android SDK:
      API Levels: 19, 21, 22, 23, 24, 25, 26, 27, 28, 29
      Build Tools: 25.0.3, 26.0.2, 27.0.3, 28.0.0, 28.0.3, 29.0.0
      System Images: android-21 | Intel x86 Atom, android-23 | Google APIs Intel x86 Atom_64, android-25 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-Q | Google Play Intel x86 Atom
  IDEs:
    Android Studio: Version  3.5.0.0 AI-191.8026.42.35.5977832
  npmPackages:
    react: 16.9.0 => 16.9.0
    react-native: 0.61.5 => 0.61.5
npx react-native --version
3.0.4
C:\Users\Sagar\Apps\react\gameapp>react-native --version
react-native-cli: 2.0.1
react-native: 0.61.5

@sagargulati
Copy link

I found a workaround for this:

yarn add @react-native-community/cli-platform-android@3.0.3
yarn add react-native@0.61.5
Removed "--quiet" from npx.cmd in native_modules.gradle
cd android && gradlew clean

@Idimma
Copy link

Idimma commented Dec 6, 2019

I found a workaround for this:

yarn add @react-native-community/cli-platform-android@3.0.3
yarn add react-native@0.61.5
Removed "--quiet" from npx.cmd in native_modules.gradle
cd android && gradlew clean

Worked fine

native_modules.gradle

can be found in

${PROJECT_FOLDER}/node_modules/@react-native-community/cli-platform-android/native_modules.gradle

if you use yarn check @sibelius answer up here

You will need to clear gradle cache also

@nonewcode
Copy link

I did not install react-native and react-native-cli , and i also run npm uninstall -g react-native react-native-cli

When remove the native_modules.gradle comment /* dir */

def reactNativeConfigOutput = this.getCommandOutput(command, /* dir */) 

to

def reactNativeConfigOutput = this.getCommandOutput(command, dir)

it's ok.

This fixed the issue for me

@pstanton

This comment has been minimized.

@rvgroup

This comment has been minimized.

@jfrolich
Copy link

Same issue here on CI. Locally it works. Perhaps it's because it is using npx and we use yarn?

@thymikee
Copy link
Member

We use npx because it should be universally available along with Node.js. Using yarn to install deps shouldn't matter, but we've seen some reports of npx not behaving as advertised.

@jfrolich
Copy link

It stopped working when upgrading react-native from 0.61.4 to 0.61.5. But then after downgrading the problem is still happening so it could also have something to do with the global CI config (app center). Let me investigate this further.

@jfrolich
Copy link

jfrolich commented Dec 18, 2019

It's definitely the npx command that not behaving well. The old version of cli-platform-android works perfectly fine. The working version is: "3.0.0-alpha.2"

@jfrolich
Copy link

For other people that are affected, this in your package.json will fix it for you:

  "resolutions": {
    "@react-native-community/cli-platform-android": "3.0.0-alpha.2"
  },

@rzane
Copy link

rzane commented Dec 18, 2019

Uncommenting /* dir */ also fixes the issue for me. Here are more specifics:

  • This is happening on Microsoft AppCenter
  • My React Native app does not live in the root of the repo. It's in a mobile/ directory.
  • AppCenter doesn't cd mobile. Instead it's just firing off mobile/android/gradlew from the root
  • Because the second argument dir is commented out, I think npx is being run at the root of my repo, which isn't going to work.

@rzane
Copy link

rzane commented Dec 18, 2019

I believe there are several duplicate issues here:

They appear to be a result of this change: #852

@jfrolich
Copy link

I indeed removed 'react-native-cli' and 'react-native' global packages with

yarn global remove react-native-cli react-native and npm uninstall -g react-native-cli react-native

But I guess I only really needed to enter android folder and run ./gradlew clean

Kinda of what @sagargulati pointed out. Except I did not edit the native_modules.gradle file.

I wish you all nice holidays

Do you also have a monorepo where the app resides in a subfolder when compiling on app center?

@SaeedZhiany
Copy link

None of the answers works,

I run npm uninstall -g react-native-cli react-native for being sure that the tools removed globally. but I just got up to date in 0.034s message in cmd. (I don't know it's normal or not) still doesn't fix.

here is my result of npx.cmd --quiet --no-install react-native config

{
  "root": "C:\\Users\\SAEED\\Desktop\\MyTSProject",
  "reactNativePath": "C:\\Users\\SAEED\\Desktop\\MyTSProject\\node_modules\\react-native",
  "dependencies": {
    "react-native-svg": {
      "root": "C:\\Users\\SAEED\\Desktop\\MyTSProject\\node_modules\\react-native-svg",
      "name": "react-native-svg",
      "platforms": {
        "ios": {
          "sourceDir": "C:\\Users\\SAEED\\Desktop\\MyTSProject\\node_modules\\react-native-svg\\ios",
          "folder": "C:\\Users\\SAEED\\Desktop\\MyTSProject\\node_modules\\react-native-svg",
          "pbxprojPath": "C:\\Users\\SAEED\\Desktop\\MyTSProject\\node_modules\\react-native-svg\\ios\\RNSVG.xcodeproj\\project.pbxproj",
          "podfile": null,
          "podspecPath": "C:\\Users\\SAEED\\Desktop\\MyTSProject\\node_modules\\react-native-svg\\RNSVG.podspec",
          "projectPath": "C:\\Users\\SAEED\\Desktop\\MyTSProject\\node_modules\\react-native-svg\\ios\\RNSVG.xcodeproj",          "projectName": "RNSVG.xcodeproj",
          "libraryFolder": "Libraries",
          "sharedLibraries": [],
          "plist": [],
          "scriptPhases": []
        },
        "android": {
          "sourceDir": "C:\\Users\\SAEED\\Desktop\\MyTSProject\\node_modules\\react-native-svg\\android",
          "folder": "C:\\Users\\SAEED\\Desktop\\MyTSProject\\node_modules\\react-native-svg",
          "packageImportPath": "import com.horcrux.svg.SvgPackage;",
          "packageInstance": "new SvgPackage()"
        }
      },
      "assets": [],
      "hooks": {},
      "params": []
    }
  },
  "commands": [
    {
      "name": "log-ios",
      "description": "starts iOS device syslog tail"
    },
    {
      "name": "run-ios",
      "description": "builds your app and starts it on iOS simulator",
      "examples": [
        {
          "desc": "Run on a different simulator, e.g. iPhone 5",
          "cmd": "react-native run-ios --simulator \"iPhone 5\""
        },
        {
          "desc": "Pass a non-standard location of iOS directory",
          "cmd": "react-native run-ios --project-path \"./app/ios\""
        },
        {
          "desc": "Run on a connected device, e.g. Max's iPhone",
          "cmd": "react-native run-ios --device \"Max's iPhone\""
        },
        {
          "desc": "Run on the AppleTV simulator",
          "cmd": "react-native run-ios --simulator \"Apple TV\"  --scheme \"helloworld-tvOS\""
        }
      ],
      "options": [
        {
          "name": "--simulator [string]",
          "description": "Explicitly set simulator to use. Optionally include iOS version betweenparenthesis at the end to match an exact version: \"iPhone 6 (10.0)\"",
          "default": "iPhone 11"
        },
        {
          "name": "--configuration [string]",
          "description": "Explicitly set the scheme configuration to use",
          "default": "Debug"
        },
        {
          "name": "--scheme [string]",
          "description": "Explicitly set Xcode scheme to use"
        },
        {
          "name": "--project-path [string]",
          "description": "Path relative to project root where the Xcode project (.xcodeproj) lives.",
          "default": "ios"
        },
        {
          "name": "--device [string]",
          "description": "Explicitly set device to use by name.  The value is not required if you have a single device connected."
        },
        {
          "name": "--udid [string]",
          "description": "Explicitly set device to use by udid"
        },
        {
          "name": "--no-packager",
          "description": "Do not launch packager while building"
        },
        {
          "name": "--verbose",
          "description": "Do not use xcpretty even if installed"
        },
        {
          "name": "--port [number]",
          "default": 8081
        },
        {
          "name": "--terminal [string]",
          "description": "Launches the Metro Bundler in a new window using the specified terminal path."
        }
      ]
    },
    {
      "name": "log-android",
      "description": "starts logkitty"
    },
    {
      "name": "run-android",
      "description": "builds your app and starts it on a connected Android emulator or device",
      "options": [
        {
          "name": "--root [string]",
          "description": "Override the root directory for the android build (which contains the android directory)",
          "default": ""
        },
        {
          "name": "--variant [string]",
          "description": "Specify your app's build variant",
          "default": "debug"
        },
        {
          "name": "--appFolder [string]",
          "description": "Specify a different application folder name for the android source. If not, we assume is \"app\"",
          "default": "app"
        },
        {
          "name": "--appId [string]",
          "description": "Specify an applicationId to launch after build.",
          "default": ""
        },
        {
          "name": "--appIdSuffix [string]",
          "description": "Specify an applicationIdSuffix to launch after build.",
          "default": ""
        },
        {
          "name": "--main-activity [string]",
          "description": "Name of the activity to start",
          "default": "MainActivity"
        },
        {
          "name": "--deviceId [string]",
          "description": "builds your app and starts it on a specific device/simulator with the given device id (listed by running \"adb devices\" on the command line)."
        },
        {
          "name": "--no-packager",
          "description": "Do not launch packager while building"
        },
        {
          "name": "--port [number]",
          "default": 8081
        },
        {
          "name": "--terminal [string]",
          "description": "Launches the Metro Bundler in a new window using the specified terminal path."
        },
        {
          "name": "--tasks [list]",
          "description": "Run custom Gradle tasks. By default it's \"installDebug\""
        },
        {
          "name": "--no-jetifier",
          "description": "Do not run \"jetifier\" – the AndroidX transition tool. By default it runs before Gradle to ease working with libraries that don't support AndroidX yet. See more at: https://www.npmjs.com/package/jetifier.",
          "default": false
        }
      ]
    }
  ],
  "assets": [],
  "platforms": {
    "ios": {},
    "android": {}
  },
  "haste": {
    "providesModuleNodeModules": [
      "react-native"
    ],
    "platforms": [
      "ios",
      "android"
    ]
  },
  "project": {
    "ios": {
      "sourceDir": "C:\\Users\\SAEED\\Desktop\\MyTSProject\\ios",
      "folder": "C:\\Users\\SAEED\\Desktop\\MyTSProject",
      "pbxprojPath": "C:\\Users\\SAEED\\Desktop\\MyTSProject\\ios\\MyTSProject.xcodeproj\\project.pbxproj",
      "podfile": "C:\\Users\\SAEED\\Desktop\\MyTSProject\\ios\\Podfile",
      "podspecPath": null,
      "projectPath": "C:\\Users\\SAEED\\Desktop\\MyTSProject\\ios\\MyTSProject.xcodeproj",
      "projectName": "MyTSProject.xcodeproj",
      "libraryFolder": "Libraries",
      "sharedLibraries": [],
      "plist": [],
      "scriptPhases": []
    },
    "android": {
      "sourceDir": "C:\\Users\\SAEED\\Desktop\\MyTSProject\\android\\app",
      "isFlat": false,
      "folder": "C:\\Users\\SAEED\\Desktop\\MyTSProject",
      "stringsPath": "C:\\Users\\SAEED\\Desktop\\MyTSProject\\android\\app\\src\\main\\res\\values\\strings.xml",
      "manifestPath": "C:\\Users\\SAEED\\Desktop\\MyTSProject\\android\\app\\src\\main\\AndroidManifest.xml",
      "buildGradlePath": "C:\\Users\\SAEED\\Desktop\\MyTSProject\\android\\app\\build.gradle",
      "settingsGradlePath": "C:\\Users\\SAEED\\Desktop\\MyTSProject\\android\\settings.gradle",
      "assetsPath": "C:\\Users\\SAEED\\Desktop\\MyTSProject\\android\\app\\src\\main\\assets",
      "mainFilePath": "C:\\Users\\SAEED\\Desktop\\MyTSProject\\android\\app\\src\\main\\java\\com\\mytsproject\\MainApplication.java",
      "packageName": "com.mytsproject"
    }
  }
}

@nabil-hamisa
Copy link

nabil-hamisa commented Jan 8, 2020

check if your running react-native run-android twice in a separate terminal that could be causing the problem

@SaeedZhiany
Copy link

it's for a few days ago, so I can't remember exactly, but usually I start one react-native instance (using react-native start) to make sure all of next commands using same react-native instance process and then run react-native run-android instances. However, I'll check it again, Thanks

@GoldenMaximo
Copy link

GoldenMaximo commented Jan 10, 2020

it's for a few days ago, so I can't remember exactly, but usually I start one react-native instance (using react-native start) to make sure all of next commands using same react-native instance process and then run react-native run-android instances. However, I'll check it again, Thanks

Pretty much what worked for me. I wasn't running react-native start before react-native run-android. That and doing cd android then gradlew clean also helps.

@grabbou
Copy link
Member

grabbou commented Jan 13, 2020

Surprisingly, a lot of issues here were resolved by doing something totally irrelevant to the CLI.

I believe the title of this issue is misleading because many builds can "fail with an exception". This is the standard Android failure that can happen on many occasions.

I am going to close this issue and encourage you to open other issues in the future with more verbose title/description to not confuse anyone.

Also, npx is going away in the next release - #886 - so many of these errors should be resolved as well.

@grabbou grabbou closed this as completed Jan 13, 2020
@cahhvoy
Copy link

cahhvoy commented Jan 19, 2020

same issue still persists but i found a work around :
cd into the android app of your app and run gradlew --stop
then run gradlew clean
i found it works better on a terminal with elevated privileges

after it finishes run your app the normal way

@camilo86
Copy link

I was seeing the same issue. I did the following to fix it:

  • Delete node_modules/ & /android/app/build
  • install dependencies npm install
  • Open project in android studio, and make a build
  • Profit

running npx react-native run-android now works again 😆

@andriadze
Copy link

Okay for me it was something different. I was using nvm with lower node(7.4.0) as a default version. I thought I specified nvm to use latest for this Project folder, but it did not work.

After setting latest node as global default in nvm it fixed the issue.

Also, funny thing is project was running fine with run-android but would not sync in Android Studio.

@iamadityaaz
Copy link

yarn add @react-native-community/cli-platform-android@3.0.3
yarn add react-native@0.61.5

Simply , below code solved for me :

yarn add @react-native-community/cli-platform-android@3.0.3
yarn add react-native@0.61.5

@SaeedZhiany
Copy link

@trrfrr

Sorry for late,
I created a new project using

npx react-native init TestProject --template react-native-template-typescript

When I run react run-android it opens a new cmd to start nodejs (so I'm pretty sure always one run-android command is running) but when it tries to build android apk it gives me this error:

unlike to @b1ngx's log file, I have an error in line 200. I check the line in native_modules.gradle file, an exception thrown at the line that its message is already printed in the console log, so it does not help me to find what is wrong.

:ReactNative:Failed to parse React Native CLI configuration: java.lang.RuntimeException: Unable to load FastStringService

FAILURE: Build failed with an exception.

* Where:
Script 'C:\Users\SAEED\workspace\TestProject\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 200

* What went wrong:
A problem occurred evaluating script.
> Failed to parse React Native CLI configuration. Expected running 'npx.cmd --quiet --no-install react-native config' command from 'C:\Users\SAEED\workspace\TestProject' directory to output valid JSON, but it didn't. This may be caused by npx resolving to a legacy global react-native binary. Please make sure to uninstall any global 'react-native' binaries: 'npm uninstall -g react-native react-native-cli' and try again

* 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 2s

@iamadityaaz
I checked cli-platform-android version, the init command install version 3.0.3 itself, so there is no need to installing it manually

image

Also, I have previously uninstalled the global react-native and react-native-cli packages

@SaeedZhiany
Copy link

I think I found what is wrong with my project, I'm using gradle wrapper version 5.6 which has a bug with new JsonSlurper().parseText(reactNativeConfigOutput) statement, you can see related issue here.

So upgrading to an upper version like 5.6.4 solved my problem.

@grabbou

is it possible to somehow check the Gradle wrapper version in the native_modules.gradle and show a better error message if the user Gradle wrapper version is 5.6, or at least document this in Get start* page in RN website?

@grabbou
Copy link
Member

grabbou commented Jan 29, 2020

is it possible to somehow check the Gradle wrapper version in the native_modules.gradle and show a better error message if the user Gradle wrapper version is 5.6, or at least document this in Get start* page in RN website?

This is a good idea. I would recommend sending a PR to the CLI that adds "Troubleshooting" section to the main readme.

@iamadityaaz
Copy link

iamadityaaz commented Jan 29, 2020

@trrfrr

Sorry for late,
I created a new project using

npx react-native init TestProject --template react-native-template-typescript

When I run react run-android it opens a new cmd to start nodejs (so I'm pretty sure always one run-android command is running) but when it tries to build android apk it gives me this error:

unlike to @b1ngx's log file, I have an error in line 200. I check the line in native_modules.gradle file, an exception thrown at the line that its message is already printed in the console log, so it does not help me to find what is wrong.

:ReactNative:Failed to parse React Native CLI configuration: java.lang.RuntimeException: Unable to load FastStringService

FAILURE: Build failed with an exception.

* Where:
Script 'C:\Users\SAEED\workspace\TestProject\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 200

* What went wrong:
A problem occurred evaluating script.
> Failed to parse React Native CLI configuration. Expected running 'npx.cmd --quiet --no-install react-native config' command from 'C:\Users\SAEED\workspace\TestProject' directory to output valid JSON, but it didn't. This may be caused by npx resolving to a legacy global react-native binary. Please make sure to uninstall any global 'react-native' binaries: 'npm uninstall -g react-native react-native-cli' and try again

* 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 2s

@iamadityaaz
I checked cli-platform-android version, the init command install version 3.0.3 itself, so there is no need to installing it manually

image

Also, I have previously uninstalled the global react-native and react-native-cli packages

@SaeedZhiany
What is the react-native version you are using ?
And you don't need to uninstall react-native-cli globally.

@SaeedZhiany
Copy link

@iamadityaaz

I'm using RN v0.61.5

And you don't need to uninstall react-native-cli globally.

RN website says it's needed;

If you previously installed a global react-native-cli package, please remove it as it may cause unexpected issues.

@NightWarrior
Copy link

NightWarrior commented Feb 11, 2020

I was getting this issue and nothing seemed to fix it. Until i noticed that i was using a gradle version higher than what the guide had suggested.

Go to

android/gradle/wrapper/gradle-wrapper.properties

And ensure yourdistributionUrl is the same as what your guide or upgrade helper suggests.

Edit: Also, there seemed to be some issue with with node that it would not install the correct packages, check your node_modules directory to check if the package was installed correctly or not (file with the script exists or not). I used yarn instead and it installed things correctly.

@josebleles
Copy link

I found a workaround for this:

yarn add @react-native-community/cli-platform-android@3.0.3
yarn add react-native@0.61.5
Removed "--quiet" from npx.cmd in native_modules.gradle
cd android && gradlew clean

THAT'S WORKING THANKS!!!!

@MostafaMAbdellateif
Copy link

I just deleted the build folder that's inside the android/app, i don't know what is the cause for this issue so my solution obviously may not work, but i will just leave it here in case someone has the same issue as me

@MatteoAlberghini
Copy link

same issue still persists but i found a work around :
cd into the android app of your app and run gradlew --stop
then run gradlew clean
i found it works better on a terminal with elevated privileges

after it finishes run your app the normal way

This worked for me, thank you.

@radihuq
Copy link

radihuq commented Jun 20, 2020

I'm working in a monorepo. The file exists, but it was in my project root's node_modules/@react-native-community NOT the package node_modules.

To fix this, I updated the paths

/android/settings.gradle : Line 2

apply from: file("../../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

/android/app/build.gradle : Line 225

apply from: file("../../../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

@aaelephant
Copy link

must gradel 6.2.all . it is work for me

@dyrkow
Copy link

dyrkow commented Sep 4, 2020

I'm working in a monorepo. The file exists, but it was in my project root's node_modules/@react-native-community NOT the package node_modules.

To fix this, I updated the paths

/android/settings.gradle : Line 2

apply from: file("../../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

/android/app/build.gradle : Line 225

apply from: file("../../../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

I'm too working in a monorepo. I just add line to nohois in root package.json

    "nohoist": [
+      "**/@react-native-community/**",
       "**react-native**",
       ...
    ]

@Stickman-theDev
Copy link

I deleted the build folder inside the path \android\app and rebuilt the project

@mr7developer

This comment has been minimized.

@divyaboominathan
Copy link

hai guys I got the same error. please help me
:ReactNative:Running '[node, -e, console.log(require('react-native/cli').bin);]' command failed.

FAILURE: Build failed with an exception.

  • Where:
    Script 'D:\GitHub\workspace\kidscare\node_modules@react-native-community\cli-platform-android\native_modules.gradle' line: 182

  • What went wrong:
    A problem occurred evaluating script.

No such property: buff for class: ReactNativeModules

  • 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 5s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
:ReactNative:Running '[node, -e, console.log(require('react-native/cli').bin);]' command failed.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@kesha-antonov
Copy link

I've had

$ cd android/ && ./gradlew clean && cd ..

FAILURE: Build failed with an exception.

* Where:
Settings file '/Users/kesha/projects/android/settings.gradle' line: 2

* What went wrong:
A problem occurred evaluating settings 'xxx_app'.
> Could not open dsl generic class cache for script '/Users/kesha/projects/xxxapp/node_modules/@react-native-community/cli-platform-android/native_modules.gradle' (/Users/kesha/.gradle/caches/6.9/scripts/b22gxm0vrg16tylp3a6ckofff).
   > BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 61

* 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
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Solved with

kesha :: ~/projects ‹search*› » java --version                                                                                                              1 ↵
openjdk 17.0.1 2021-10-19
OpenJDK Runtime Environment Homebrew (build 17.0.1+1)
OpenJDK 64-Bit Server VM Homebrew (build 17.0.1+1, mixed mode, sharing)
kesha :: ~/projects ‹search*› » brew remove java
Error: Refusing to uninstall /usr/local/Cellar/openjdk/17.0.1_1
because it is required by bundletool and selenium-server, which are currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies java
kesha :: ~/projects/xxxapp ‹search*› » brew uninstall --ignore-dependencies java                                                                                   1 ↵
Uninstalling /usr/local/Cellar/openjdk/17.0.1_1... (639 files, 305.2MB)
kesha :: ~/projects ‹search*› » java --version                           
openjdk 15.0.2 2021-01-19
OpenJDK Runtime Environment AdoptOpenJDK (build 15.0.2+7)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 15.0.2+7, mixed mode, sharing)

@Djouko
Copy link

Djouko commented Apr 13, 2022

Hello . please, I have an error for a yawn and I don't know how to solve. I really need help!

* Exception is: org.gradle.api.GradleScriptException: A problem occurred evaluating settings 'ToDoList'. at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93) at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.lambda$apply$0(DefaultScriptPluginFactory.java:133) at org.gradle.configuration.DefaultScriptTarget.addConfiguration(DefaultScriptTarget.java:74) at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:136) at org.gradle.configuration.BuildOperationScriptPlugin$1.run(BuildOperationScriptPlugin.java:65) at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29) at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26) at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75) at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68) at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56) at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:71) at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45) at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:71) at org.gradle.configuration.BuildOperationScriptPlugin.lambda$apply$0(BuildOperationScriptPlugin.java:62) at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:43) at org.gradle.configuration.BuildOperationScriptPlugin.apply(BuildOperationScriptPlugin.java:62) at org.gradle.initialization.ScriptEvaluatingSettingsProcessor.applySettingsScript(ScriptEvaluatingSettingsProcessor.java:74) at org.gradle.initialization.ScriptEvaluatingSettingsProcessor.process(ScriptEvaluatingSettingsProcessor.java:67) at org.gradle.initialization.SettingsEvaluatedCallbackFiringSettingsProcessor.process(SettingsEvaluatedCallbackFiringSettingsProcessor.java:34) at org.gradle.initialization.RootBuildCacheControllerSettingsProcessor.process(RootBuildCacheControllerSettingsProcessor.java:47) at org.gradle.initialization.BuildOperationSettingsProcessor$2.call(BuildOperationSettingsProcessor.java:50) at org.gradle.initialization.BuildOperationSettingsProcessor$2.call(BuildOperationSettingsProcessor.java:47) at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200) at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195) at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75) at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68) at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62) at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76) at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54) at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76) at org.gradle.initialization.BuildOperationSettingsProcessor.process(BuildOperationSettingsProcessor.java:47) at org.gradle.initialization.DefaultSettingsLoader.findSettingsAndLoadIfAppropriate(DefaultSettingsLoader.java:127) at org.gradle.initialization.DefaultSettingsLoader.findAndLoadSettings(DefaultSettingsLoader.java:65) at org.gradle.initialization.SettingsAttachingSettingsLoader.findAndLoadSettings(SettingsAttachingSettingsLoader.java:35) at org.gradle.internal.composite.CommandLineIncludedBuildSettingsLoader.findAndLoadSettings(CommandLineIncludedBuildSettingsLoader.java:34) at org.gradle.internal.composite.ChildBuildRegisteringSettingsLoader.findAndLoadSettings(ChildBuildRegisteringSettingsLoader.java:53) at org.gradle.internal.composite.CompositeBuildSettingsLoader.findAndLoadSettings(CompositeBuildSettingsLoader.java:35) at org.gradle.initialization.DefaultSettingsPreparer.prepareSettings(DefaultSettingsPreparer.java:36) at org.gradle.initialization.BuildOperationFiringSettingsPreparer$LoadBuild.doLoadBuild(BuildOperationFiringSettingsPreparer.java:62) at org.gradle.initialization.BuildOperationFiringSettingsPreparer$LoadBuild.run(BuildOperationFiringSettingsPreparer.java:57) at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29) at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26) at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75) at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68) at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56) at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:71) at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45) at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:71) at org.gradle.initialization.BuildOperationFiringSettingsPreparer.prepareSettings(BuildOperationFiringSettingsPreparer.java:45) at org.gradle.initialization.DefaultGradleLauncher.prepareSettings(DefaultGradleLauncher.java:218) at org.gradle.initialization.DefaultGradleLauncher.doClassicBuildStages(DefaultGradleLauncher.java:159) at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:148) at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:124) at org.gradle.internal.invocation.GradleBuildController$1.create(GradleBuildController.java:72) at org.gradle.internal.invocation.GradleBuildController$1.create(GradleBuildController.java:67) at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:213) at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:67) at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:56) at org.gradle.tooling.internal.provider.runner.AbstractClientProvidedBuildActionRunner.runClientAction(AbstractClientProvidedBuildActionRunner.java:53) at org.gradle.tooling.internal.provider.runner.ClientProvidedPhasedActionRunner.run(ClientProvidedPhasedActionRunner.java:47) at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) at org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:63) at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32) at org.gradle.tooling.internal.provider.FileSystemWatchingBuildActionRunner.run(FileSystemWatchingBuildActionRunner.java:77) at org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:41) at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:49) at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:44) at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200) at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195) at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75) at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68) at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62) at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76) at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54) at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76) at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:44) at org.gradle.launcher.exec.InProcessBuildActionExecuter.lambda$execute$0(InProcessBuildActionExecuter.java:59) at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:86) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:58) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30) at org.gradle.launcher.exec.BuildTreeScopeLifecycleBuildActionExecuter.lambda$execute$0(BuildTreeScopeLifecycleBuildActionExecuter.java:33) at org.gradle.internal.buildtree.BuildTreeState.run(BuildTreeState.java:53) at org.gradle.launcher.exec.BuildTreeScopeLifecycleBuildActionExecuter.execute(BuildTreeScopeLifecycleBuildActionExecuter.java:32) at org.gradle.launcher.exec.BuildTreeScopeLifecycleBuildActionExecuter.execute(BuildTreeScopeLifecycleBuildActionExecuter.java:27) at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:104) at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:55) at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:64) at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:37) at org.gradle.tooling.internal.provider.SessionScopeLifecycleBuildActionExecuter.lambda$execute$0(SessionScopeLifecycleBuildActionExecuter.java:54) at org.gradle.internal.session.BuildSessionState.run(BuildSessionState.java:67) at org.gradle.tooling.internal.provider.SessionScopeLifecycleBuildActionExecuter.execute(SessionScopeLifecycleBuildActionExecuter.java:50) at org.gradle.tooling.internal.provider.SessionScopeLifecycleBuildActionExecuter.execute(SessionScopeLifecycleBuildActionExecuter.java:36) at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36) at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25) at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:59) at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:31) at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:55) at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:41) at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:47) at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:31) at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:65) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:39) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:29) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:35) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:78) at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:75) at org.gradle.util.Swapper.swap(Swapper.java:38) at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:75) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:63) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:84) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:52) at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56) Caused by: org.gradle.api.resources.MissingResourceException: Could not read script 'C:\Users\KRATOS\Documents\formation\laravel\ToDoList\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' as it does not exist. at org.gradle.internal.resource.UriTextResource.getText(UriTextResource.java:147) at org.gradle.internal.resource.CachingTextResource.maybeFetch(CachingTextResource.java:112) at org.gradle.internal.resource.CachingTextResource.getContentHash(CachingTextResource.java:100) at org.gradle.groovy.scripts.internal.CrossBuildInMemoryCachingScriptClassCache.getOrCompile(CrossBuildInMemoryCachingScriptClassCache.java:43) at org.gradle.groovy.scripts.internal.BuildScopeInMemoryCachingScriptClassCompiler.compile(BuildScopeInMemoryCachingScriptClassCompiler.java:50) at org.gradle.groovy.scripts.DefaultScriptCompilerFactory$ScriptCompilerImpl.compile(DefaultScriptCompilerFactory.java:49) at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:110) at org.gradle.configuration.BuildOperationScriptPlugin$1.run(BuildOperationScriptPlugin.java:65) at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29) at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26) at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75) at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68) at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56) at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:71) at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45) at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:71) at org.gradle.configuration.BuildOperationScriptPlugin.lambda$apply$0(BuildOperationScriptPlugin.java:62) at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:43) at org.gradle.configuration.BuildOperationScriptPlugin.apply(BuildOperationScriptPlugin.java:62) at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyScript(DefaultObjectConfigurationAction.java:149) at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$000(DefaultObjectConfigurationAction.java:42) at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$1.run(DefaultObjectConfigurationAction.java:75) at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:183) at org.gradle.groovy.scripts.DefaultScript.apply(DefaultScript.java:128) at org.gradle.api.Script$apply.callCurrent(Unknown Source) at settings_31wlox1di7449xd4xxdztpnzv.run(C:\Users\KRATOS\Documents\formation\laravel\ToDoList\android\settings.gradle:2) at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:91) ... 135 more

@Abdeladim101Basraoui
Copy link

Abdeladim101Basraoui commented Aug 23, 2022

Hello community

I'm facing an error in cli-platform-android\native_modules.gradle in line:197

> react-native run-android

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1083 file(s) to forward-jetify. Using 4 workers...
info JS server already running.
info Installing the app...

FAILURE: Build failed with an exception.

* Where:
Script 'C:\Users\abdom\Documents\LoginID\react-native-plaid-link-sdk\example\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 197

* What went wrong:
A problem occurred evaluating project ':app'.
> Project with path ':react-native-community_clipboard' could not be found in project ':app'.

* 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 7s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* Where:
Script 'C:\Users\abdom\Documents\LoginID\react-native-plaid-link-sdk\example\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 197

* What went wrong:
A problem occurred evaluating project ':app'.
> Project with path ':react-native-community_clipboard' could not be found in project ':app'.

* 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 7s

    at makeError (C:\Users\abdom\Documents\LoginID\react-native-plaid-link-sdk\example\node_modules\react-native\node_modules\execa\index.js:174:9)
    at C:\Users\abdom\Documents\LoginID\react-native-plaid-link-sdk\example\node_modules\react-native\node_modules\execa\index.js:278:16
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async runOnAllDevices (C:\Users\abdom\Documents\LoginID\react-native-plaid-link-sdk\example\node_modules\react-native\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
    at async Command.handleAction (C:\Users\abdom\Documents\LoginID\react-native-plaid-link-sdk\example\node_modules\@react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details.

React-native Info

$ react-native info
info Fetching system and libraries information...
(node:5956) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
System:
    OS: Windows 10 10.0.19044
    CPU: (4) x64 Intel(R) Core(TM) i5-7300U CPU @ 2.60GHz
    Memory: 1.77 GB / 7.89 GB
  Binaries:
    Node: 16.16.0 - C:\Program Files\nodejs\node.EXE
    Yarn: Not Found
    npm: 8.11.0 - C:\Program Files\nodejs\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK: Not Found
    Windows SDK: Not Found
  IDEs:
    Android Studio: AI-212.5712.43.2112.8815526
    Visual Studio: 17.1.32210.238 (Visual Studio Community 2022)
  Languages:
    Java: 17.0.4 - /c/Program Files/Common Files/Oracle/Java/javapath/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2
    react-native: 0.66.4 => 0.66.4
    react-native-windows: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

React-native Version
$ react-native -v react-native-cli: 2.0.1 react-native: 0.66.4

I tried to reinstall the package but nothing change
I'd be thankful if there's any additional details to share to solve this issue ,CodeSafe

@yunatamos
Copy link

open that android studio with command line

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests