cli icon indicating copy to clipboard operation
cli copied to clipboard

@react-native-community/cli-platform-android Build Failed: The current character read is 'i' with an int value of 105

Open ablack34 opened this issue 3 years ago • 58 comments

I was building, running and demoing my app at 11:30am this morning using npx react-native run-android, I made a PR and merged my branch into Dev an hour later. The build failed with the error below. I thought this was odd so in my local I deleted node_modules and package-lock.json, ran cd android && ./gradlew clean, then cd.. and npx react-native run-android. My local started producing this same error. I have no idea what could have changed or what would have caused this.

I have been googling and trying different solutions with no success and a deadline looming. Can anybody help guide me to a solution please? TIA!

Environment

react-native info

System:
    OS: Windows 10 10.0.22621
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
    Memory: 10.99 GB / 31.85 GB
  Binaries:
    Node: 16.18.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK: Not Found
    Windows SDK: Not Found
  IDEs:
    Android Studio: Not Found
    Visual Studio: 17.5.33627.172 (Visual Studio Enterprise 2022)
  Languages:
    Java: 11.0.16.1
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.1.0 => 18.1.0
    react-native: 0.70.7 => 0.70.7
    react-native-windows: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
**react-native --version**
react-native-cli: 2.0.1
react-native: 0.70.7

Description

npx react-native run-android


warn Package react-native-sqlite-storage contains invalid configuration: "dependency.platforms.ios.project" is not allowed. Please verify it's properly linked using "react-native config" command and contact the package maintainers about this.
info Starting JS server...
info Launching emulator...
info Successfully launched emulator.
info Installing the app...

FAILURE: Build failed with an exception.

* Where:
Script 'C:\Users\Public\xyz\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 450

* What went wrong:
A problem occurred evaluating script.
> Calling `[node, C:\Users\Public\xyz\node_modules\@react-native-community\cli\build\bin.js, config]` finished with an exception. Error message: 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 CLI with --verbose flag for more details.
 ^. Output: info Run CLI with --verbose flag for more details.

* 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\Public\xyz\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 450

* What went wrong:
A problem occurred evaluating script.
> Calling `[node, C:\Users\Public\xyz\node_modules\@react-native-community\cli\build\bin.js, config]` finished with an exception. Error message: 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 CLI with --verbose flag for more details.
 ^. Output: info Run CLI with --verbose flag for more details.

* 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\Public\xyz\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
   at C:\Users\Public\xyz\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
   at processTicksAndRejections (node:internal/process/task_queues:96:5)
   at async runOnAllDevices (C:\Users\Public\xyz\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
   at async Command.handleAction (C:\Users\Public\xyz\node_modules\@react-native-community\cli\build\index.js:142:9)
info Run CLI with --verbose flag for more details.
   

ablack34 avatar Jun 21 '23 21:06 ablack34

Hey @fahmiabdulyakub, you must check in your package.json what packages do you have, and then check release notes / changelog in these packages, and downgrade to version that have package field in AndroidManifest.xml.

Note: You should have fix for that as you're using 0.71, mind upgrading to the latest version of 0.71 or 0.72?

I still confuse about that solution. This my package.json and AndroidManifest.xml. What I'm suppose to do ?

{
  "name": "MyApp",
  "version": "2.1.3",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
    "gradleclear": "cd android && bash gradlew clean && cd ../",
    "android:stage": "react-native run-android --variant=stagingDebug",
    "android:stage-release": "react-native run-android --variant=stagingRelease",
    "android:ip": "react-native run-android --variant=ipDebug",
    "android:ip-release": "react-native run-android --variant=ipRelease",
    "android:prod": "react-native run-android --variant=productionDebug",
    "android:prod-release": "react-native run-android --variant=productionRelease",
    "buildapk:stage": "cd android && bash gradlew clean && bash gradlew app:assembleStagingRelease && cd ../",
    "buildapk:ip": "cd android && bash gradlew clean && bash gradlew app:assembleIpRelease && cd ../",
    "buildapk:prod": "cd android && bash gradlew clean && bash gradlew app:assembleProductionRelease && cd ../",
    "buildbundle:aab": "cd android && bash gradlew clean && bash gradlew bundleProductionRelease && cd ../"
  },
  "dependencies": {
    "@apollo/client": "^3.7.10",
    "@notifee/react-native": "^7.0.4",
    "@myapp/react-native-calendar-picker": "^1.0.14",
    "@myapp/uikit-mobile": "^0.0.95",
    "@react-native-community/blur": "^4.3.2",
    "@react-native-community/cli": "^10.1.3",
    "@react-native-community/cli-platform-android": "^10.0.0",
    "@react-native-community/clipboard": "^1.5.1",
    "@react-native-community/datetimepicker": "^7.0.0",
    "@react-native-community/netinfo": "^9.3.6",
    "@react-native-firebase/analytics": "^17.4.2",
    "@react-native-firebase/app": "^17.4.2",
    "@react-native-firebase/crashlytics": "^17.4.2",
    "@react-native-firebase/dynamic-links": "^17.4.2",
    "@react-native-firebase/messaging": "^17.4.2",
    "@react-native-picker/picker": "^2.4.8",
    "@react-navigation/bottom-tabs": "^6.5.7",
    "@react-navigation/native": "^6.1.6",
    "@react-navigation/native-stack": "^6.8.0",
    "@react-navigation/stack": "^6.3.16",
    "@reduxjs/toolkit": "^1.8.5",
    "apollo-link-rest": "^0.9.0",
    "axios": "^0.27.2",
    "babel-plugin-module-resolver": "^4.1.0",
    "base-64": "^1.0.0",
    "dayjs": "^1.11.5",
    "deprecated-react-native-prop-types": "^4.0.0",
    "hermes-engine": "^0.11.0",
    "i": "^0.3.7",
    "i18next": "^21.9.1",
    "install": "^0.13.0",
    "lodash": "^4.17.21",
    "lottie-ios": "^3.2.3",
    "moment": "^2.29.1",
    "moment-timezone": "^0.5.40",
    "native-base": "^3.4.20",
    "npm": "^8.19.4",
    "react": "18.2.0",
    "react-i18next": "^11.18.5",
    "react-native": "0.71.3",
    "react-native-bluetooth-escpos-printer": "^0.0.5",
    "react-native-calendar-picker": "^7.1.2",
    "react-native-camera": "^4.2.1",
    "react-native-cli": "^2.0.1",
    "react-native-code-push": "^8.0.2",
    "react-native-config": "^1.4.11",
    "react-native-device-info": "^10.6.0",
    "react-native-encrypted-storage": "^4.0.2",
    "react-native-fbsdk-next": "^11.2.1",
    "react-native-gesture-handler": "^2.9.0",
    "react-native-get-random-values": "^1.8.0",
    "react-native-html-to-pdf": "^0.12.0",
    "react-native-image-crop-picker": "^0.39.0",
    "react-native-image-picker": "^4.10.0",
    "react-native-in-app-review": "^4.3.3",
    "react-native-linear-gradient": "^2.6.2",
    "react-native-mixpanel": "^1.2.5",
    "react-native-pager-view": "^6.1.3",
    "react-native-pdf-thumbnail": "^1.2.1",
    "react-native-photo-manipulator": "^1.2.7",
    "react-native-render-html": "^6.3.4",
    "react-native-safe-area-context": "^4.4.0",
    "react-native-screens": "^3.20.0",
    "react-native-select-contact": "^1.6.3",
    "react-native-share": "^8.0.1",
    "react-native-snackbar": "^2.4.0",
    "react-native-splash-screen": "^3.3.0",
    "react-native-svg": "^13.6.0",
    "react-native-swiper": "^1.6.0",
    "react-native-tab-view": "^3.3.4",
    "react-native-wait-navigation": "^0.2.2",
    "react-native-webview": "^12.0.2",
    "react-native-wheel-pick": "^1.2.0",
    "react-number-format": "^5.0.1",
    "react-redux": "^8.0.4",
    "redux": "^4.2.0",
    "rn-fetch-blob": "^0.12.0",
    "yup": "^0.32.11"
  },
  "overrides": {
    "react-native-qrcode-svg": {
      "react-native-svg": "$react-native-svg"
    }
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/preset-env": "^7.20.0",
    "@babel/runtime": "^7.20.0",
    "@react-native-community/eslint-config": "^3.2.0",
    "@tsconfig/react-native": "^2.0.2",
    "@types/jest": "^29.2.1",
    "@types/moment-duration-format": "^2.2.3",
    "@types/react": "^18.0.24",
    "@types/react-test-renderer": "^18.0.0",
    "@typescript-eslint/eslint-plugin": "^5.29.0",
    "@typescript-eslint/parser": "^5.29.0",
    "babel-jest": "^29.2.1",
    "eslint": "^8.19.0",
    "jest": "^29.2.1",
    "metro-react-native-babel-preset": "^0.73.7",
    "moment-duration-format": "^2.3.2",
    "react-test-renderer": "18.2.0",
    "typescript": "^4.8.4"
  },
  "jest": {
    "preset": "react-native",
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js",
      "jsx",
      "json",
      "node"
    ]
  },
  "eslintConfig": {
    "root": true,
    "extends": "@react-native-community/eslint-config",
    "rules": {
      "prettier/prettier": 0,
      "object-curly-spacing": [
        "error",
        "always"
      ],
      "array-bracket-spacing": [
        "error",
        "always"
      ]
    }
  }
}

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.myapp.original" xmlns:tools="http://schemas.android.com/tools">

    <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
    <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
    <uses-permission android:name="android.permission.BLUETOOTH"/>
  <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
    <uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION " />
 <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
 <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" /> 
    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher"
      android:allowBackup="false"
     android:usesCleartextTraffic="true"
      android:theme="@style/AppTheme">
      <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
   	<meta-data android:name="com.facebook.sdk.ClientToken" android:value="@string/facebook_client_token"/>
        <meta-data
          android:name = "com.google.firebase.messaging.default_notification_icon"
          android:resource="@mipmap/ic_notification"
          tools:replace="android:resource"
        />
        <meta-data 
          android:name = "com.google.firebase.messaging.default_notification_color"
          android:resource="@color/myapp_color"
          tools:replace="android:resource" 
        />
      <provider
        android:name="androidx.core.content.FileProvider"
        android:authorities="${applicationId}.provider"
        android:grantUriPermissions="true"
        android:exported="false">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/filepaths" />
    </provider>
    
    <activity android:name="com.facebook.FacebookActivity"
        android:configChanges=
                "keyboard|keyboardHidden|screenLayout|screenSize|orientation"
        android:label="@string/app_name" />
    <activity
        android:name="com.facebook.CustomTabActivity"
        android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="@string/fb_login_protocol_scheme" />
        </intent-filter>
    </activity>

      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
        android:launchMode="singleTask"
      android:screenOrientation="portrait"
        android:windowSoftInputMode="adjustResize"
        android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
    <action android:name="android.intent.action.VIEW"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <category android:name="android.intent.category.BROWSABLE"/>
    <data
        android:host="myapp.co.id"
        android:scheme="https"/>
</intent-filter>
      </activity>
    </application>

      <queries>
       <package android:name="com.myapp.staging" />
        <intent>
     <action android:name="android.intent.action.PICK" />
     <category android:name="android.intent.category.DEFAULT" />
     <data android:mimeType="vnd.android.cursor.dir/contact" />
</intent>
    </queries>
</manifest>

fahmiabdulyakub avatar Jul 20 '23 06:07 fahmiabdulyakub

You shouldn't have react-native-cli in your in package.json from latest few version the React Native CLI comes with React Native, so there's no need for installing it as separate package. Please remove and check if it is working for you.

Edit: also you shouldn't have npm as separate, and

    "@react-native-community/cli": "^10.1.3",
    "@react-native-community/cli-platform-android": "^10.0.0",

szymonrybczak avatar Jul 20 '23 07:07 szymonrybczak

You shouldn't have react-native-cli in your in package.json

@szymonrybczak something to add to #1983 ?

cortinico avatar Jul 20 '23 08:07 cortinico

@szymonrybczak something to add to https://github.com/react-native-community/cli/pull/1983 ?

Good idea!

szymonrybczak avatar Jul 20 '23 09:07 szymonrybczak

For me it was caused by react-native-image-picker. Updating it fixed it

jeroenvanhattem avatar Sep 22 '23 21:09 jeroenvanhattem

1.rm -fr node_modules 2.yarn install 3.yarn react-native run-android

zhukai1204 avatar Sep 27 '23 09:09 zhukai1204

npx react-native run-android --variant=devDebug info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag. Jetifier found 2993 file(s) to forward-jetify. Using 8 workers... info Starting JS server... info Launching emulator... error Failed to launch emulator. Reason: Emulator exited before boot.. warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch. info Installing the app... :ReactNative:Running '[node, -e, try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}]' command failed.

FAILURE: Build failed with an exception.

  • Where: Script 'C:\Users\nhung\Desktop\soba\src\Soba-MobileApp\node_modules@react-native-community\cli-platform-android\native_modules.gradle' line: 397

  • What went wrong: A problem occurred evaluating script.

Could not find method exec() for arguments [ReactNativeModules$_getCommandOutput_closure16@2eaa5049] on object of type org.gradle.api.internal.provider.DefaultProviderFactory_Decorated.

  • 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

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:installDevDebug -PreactNativeDevServerPort=8081 :ReactNative:Running '[node, -e, try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}]' command failed.

FAILURE: Build failed with an exception.

  • Where: Script 'C:\Users\nhung\Desktop\soba\src\Soba-MobileApp\node_modules@react-native-community\cli-platform-android\native_modules.gradle' line: 397

  • What went wrong: A problem occurred evaluating script.

Could not find method exec() for arguments [ReactNativeModules$_getCommandOutput_closure16@2eaa5049] on object of type org.gradle.api.internal.provider.DefaultProviderFactory_Decorated.

  • 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

at makeError (C:\Users\nhung\Desktop\soba\src\Soba-MobileApp\node_modules\.pnpm\[email protected]\node_modules\execa\index.js:174:9)       
at C:\Users\nhung\Desktop\soba\src\Soba-MobileApp\node_modules\.pnpm\[email protected]\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (C:\Users\nhung\Desktop\soba\src\Soba-MobileApp\node_modules\.pnpm\@[email protected]\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\Users\nhung\Desktop\soba\src\Soba-MobileApp\node_modules\.pnpm\@[email protected]_@[email protected][email protected]\node_modules\@react-native-community\cli\build\index.js:192:9)

info Run CLI with --verbose flag for more details.

C:\Users\nhung\Desktop\soba\src\Soba-MobileApp>./gradlew clean '.' is not recognized as an internal or external command, operable program or batch file.

C:\Users\nhung\Desktop\soba\src\Soba-MobileApp>cd android

C:\Users\nhung\Desktop\soba\src\Soba-MobileApp\android>./gradlew clean '.' is not recognized as an internal or external command, operable program or batch file.

C:\Users\nhung\Desktop\soba\src\Soba-MobileApp\android>gradlew clean
Starting a Gradle Daemon, 2 incompatible Daemons could not be reused, use --status for details :ReactNative:Running '[node, -e, try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}]' command failed.

FAILURE: Build failed with an exception.

  • Where: Script 'C:\Users\nhung\Desktop\soba\src\Soba-MobileApp\node_modules@react-native-community\cli-platform-android\native_modules.gradle' line: 397

  • What went wrong: A problem occurred evaluating script.

Could not find method exec() for arguments [ReactNativeModules$_getCommandOutput_closure16@f6e6863] on object of type org.gradle.api.internal.provider.DefaultProviderFactory_Decorated.

  • 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 how to fix this i'm stuck for 2 day

nhokmoon avatar Apr 17 '24 09:04 nhokmoon

hey @nhokmoon, make sure that npx react-native config works correctly and returns proper config of your app.

szymonrybczak avatar Apr 22 '24 11:04 szymonrybczak

@nhokmoon , did you fix the issue? i've been stuck for days now.

iamblackdev avatar Apr 25 '24 04:04 iamblackdev

@nhokmoon

C:\Users\nhung\Desktop\soba\src\Soba-MobileApp\node_modules\.pnpm\[email protected]\node_modules\execa\index.js:174:9

Does RN work with PNPM nowadays? It didn't use to.

liamjones avatar Apr 25 '24 09:04 liamjones

Hello! For me, it was because of the missing package attribute in AndroidManifest.xml in the module react-native-image-resizer

In node_modules/@bam_tech/react-native-image-resizer/android/src/main/AndroidManifest.xml

- <manifest xmlns:android="http://schemas.android.com/apk/res/android">
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.reactnativeimageresizer">

And the value of package will the same as the value of namespace in node_modules/@bam_tech/react-native-image-resizer/android/build.gradle

I know that making changes directly in the node_modules is not good, so I will probably create a patch file for it.

Related to the node module:

Even though I raised a PR #399, I don't think that it is going to change in the module, since it was a change introduced in React Native 0.73 (react-native-community/discussions-and-proposals/issues/671) Maybe in the near future this will be applied in other node modules too? I don't know because the discussion I linked dates back to Jun 17, 2023

yashb-02 avatar Apr 25 '24 12:04 yashb-02

I found the solution to RN cli issues specifically for older RN versions as pointed by @nhokmoon. I am using RN 68.7. I added resolutions to my package.json to force use older RN CLI versions:

"resolutions": {
    "@react-native-community/cli": "^7.0.0",
    "@react-native-community/cli-config": "^7.0.0",
    "@react-native-community/cli-debugger-ui": "^7.0.0",
    "@react-native-community/cli-doctor": "^7.0.0",
    "@react-native-community/cli-platform-android": "^7.0.0",
    "@react-native-community/cli-platform-ios": "^7.0.0",
    "@react-native-community/cli-server-api": "^7.0.0",
    "@react-native-community/cli-tools": "^7.0.0",
    "@react-native-community/cli-types": "^7.0.0"
  }

And now the Android build is succeeding 🚀.

Check the compatible version of RN CLI version for your RN version: https://github.com/react-native-community/cli?tab=readme-ov-file#compatibility

JJSLIoT avatar Apr 30 '24 12:04 JJSLIoT

I found the solution to RN cli issues specifically for older RN versions as pointed by @nhokmoon. I am using RN 68.7. I added resolutions to my package.json to force use older RN CLI versions:

"resolutions": {
    "@react-native-community/cli": "^7.0.0",
    "@react-native-community/cli-config": "^7.0.0",
    "@react-native-community/cli-debugger-ui": "^7.0.0",
    "@react-native-community/cli-doctor": "^7.0.0",
    "@react-native-community/cli-platform-android": "^7.0.0",
    "@react-native-community/cli-platform-ios": "^7.0.0",
    "@react-native-community/cli-server-api": "^7.0.0",
    "@react-native-community/cli-tools": "^7.0.0",
    "@react-native-community/cli-types": "^7.0.0"
  }

And now the Android build is succeeding 🚀.

Check the compatible version of RN CLI version for your RN version: https://github.com/react-native-community/cli?tab=readme-ov-file#compatibility

thanks i will try it

nhokmoon avatar May 06 '24 09:05 nhokmoon

tream

Im Using 0.73 Facing Same Issue, but I also some more error Failed to install the app. Command failed with exit code 1: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 Script 'E:\Final Year Project\Phase 2\Application\React Native App\DairyPureApp\node_modules@react-native-community\cli-platform-android\native_modules.gradle' line: 401 :ReactNative:Running '[node, E:\Final Year Project\Phase 2\Application\React Native App\DairyPureApp\node_modules@react-native-community\cli\build\bin.js, config]' command failed.

malyzkhan avatar May 16 '24 19:05 malyzkhan

Hello, get same exception after upgrde to new version (0.74) of RN.

FAILURE: Build failed with an exception.

  • Where: Script 'C:\Users\nhung\Desktop\soba\src\Soba-MobileApp\node_modules@react-native-community\cli-platform-android\native_modules.gradle' line: 397

Could not find method exec() for arguments [ReactNativeModules$_getCommandOutput_closure16@f6e6863] on object of type org.gradle.api.internal.provider.DefaultProviderFactory_Decorated.

BUILD FAILED in 5s how to fix this i'm stuck for 2 day

In my case the problem was an old android\gradlew.bat It was created with previos RN version.

I copied gradlew.bat from blank project, and this issue moved away.

You may create reference project from last RN with command npx @react-native-community/cli@latest init TestProject

P.S. There are a lot other diffirences in *.gradle files comes with new version of RN.

VBarzionov avatar May 20 '24 15:05 VBarzionov

OS: Windows 10 Java 17 Gradle 7.3

Hey guys,

This might not be the place to write this, but this is the issue that was closest to the problem I was facing. I am currently trying to integrate react-native-auth0 to my Expo project.

My current dependencies are:

"dependencies": { "@expo/vector-icons": "^14.0.0", "@react-navigation/native": "^6.0.2", "expo": "~51.0.9", "expo-camera": "~15.0.10", "expo-constants": "~16.0.2", "expo-font": "~12.0.5", "expo-linking": "~6.3.1", "expo-modules-autolinking": "^1.11.1", "expo-router": "~3.5.14", "expo-splash-screen": "~0.27.4", "expo-status-bar": "~1.12.1", "expo-system-ui": "~3.0.4", "expo-web-browser": "~13.0.3", "react": "18.2.0", "react-dom": "18.2.0", "react-hook-form": "^7.51.5", "react-native": "0.74.1", "react-native-auth0": "^3.2.1", "react-native-floating-action": "^1.22.0", "react-native-gesture-handler": "~2.16.1", "react-native-reanimated": "~3.10.1", "react-native-safe-area-context": "4.10.1", "react-native-screens": "3.31.1", "react-native-web": "~0.19.10" }, "devDependencies": { "@babel/core": "^7.20.0", "@types/jest": "^29.5.12", "@types/react": "~18.2.45", "@types/react-test-renderer": "^18.0.7", "jest": "^29.2.1", "jest-expo": "~51.0.2", "react-test-renderer": "18.2.0", "typescript": "~5.3.3" },

I'm running Java 17 and Gradle 7.3 (which is what I need to use according to the compatibility matrix. The Auth0 library only runs with native code. So when trying to build the Android native code using the Expo builder, i.e. npx expo run:android, I keep getting this error:

`npx expo run:android env: load .env env: export EXPO_PUBLIC_AUTH0_DOMAIN EXPO_PUBLIC_AUTH0_CLIENT_ID › Building app... Picked up _JAVA_OPTIONS: -Xmx512M Configuration on demand is an incubating feature.

FAILURE: Build failed with an exception.

  • Where: Script '\node_modules\expo\scripts\autolinking.gradle' line: 4

  • What went wrong: A problem occurred evaluating script.

Could not find method exec() for arguments [autolinking_7wnwhgbtt7rc3qqznqll89fti$_run_closure1@46e55161] on object of type org.gradle.api.internal.provider.DefaultProviderFactory_Decorated.

  • 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 969ms Error: \android\gradlew.bat app:assembleDebug -x lint -x test --configure-on-demand --build-cache -PreactNativeDevServerPort=8081 -PreactNativeArchitectures=x86_64,arm64-v8a exited with non-zero code: 1 Error: \android\gradlew.bat app:assembleDebug -x lint -x test --configure-on-demand --build-cache -PreactNativeDevServerPort=8081 -PreactNativeArchitectures=x86_64,arm64-v8a exited with non-zero code: 1 at ChildProcess.completionListener (\node_modules@expo\spawn-async\build\spawnAsync.js:42:23) at Object.onceWrapper (node:events:629:26) at ChildProcess.emit (node:events:514:28) at cp.emit (\node_modules\cross-spawn\lib\enoent.js:34:29) at maybeClose (node:internal/child_process:1091:16) at ChildProcess._handle.onexit (node:internal/child_process:302:5) ... at spawnAsync (\node_modules@expo\spawn-async\build\spawnAsync.js:7:23) at spawnGradleAsync (\node_modules@expo\cli\build\src\start\platforms\android\gradle.js:96:48) at assembleAsync (\node_modules@expo\cli\build\src\start\platforms\android\gradle.js:74:18) at runAndroidAsync (\node_modules@expo\cli\build\src\run\android\runAndroidAsync.js:45:37)`

I get the same result when changing directory (cd) to the android folder and running gradle build.

This is the code in my expo\scripts\autolinking.gradle:

// Resolve expo>expo-modules-autolinkingdependency chain def autolinkingPath = ["node", "--print", "require.resolve('expo-modules-autolinking/package.json', { paths: [require.resolve('expo/package.json')] })"] apply from: new File( providers.exec { workingDir(rootDir) commandLine(autolinkingPath) }.standardOutput.asText.get().trim(), "../scripts/android/autolinking_implementation.gradle" )

Any help would be appreciated. Please let me know if any other information is needed. For more context, this is the repository and branch I am working on https://github.com/lnaidu14/quickpay/tree/19-integrate-auth0

lnaidu14 avatar Jun 02 '24 16:06 lnaidu14

The problem is that the package attribute is initially present in the camera-roll manifest file, but for some reason it is removed from it after running Gradle. That's why this error disappears after removing node_modules but occurs again after running a build once again. Perhaps Gradle merges manifest files somehow incorrectly. If you remove the package attribute from the manifest file of your application (android/app/src/main/AndroidManifest.xml), you will not get this error (although then you will get another error saying that the package attribute must be present in the manifest file of your application). In the node_modules/@react-native-camera-roll/camera-roll/android/build.gradle file there's a property of namespace however, it is used conditionally. Maybe it should always be included? image

UPD. I just changed the line def shouldUseNameSpace = agpVersion >= 7 to def shouldUseNameSpace = false and created a patch using patch-package and the issue was resolved for me.

arthedza avatar Jun 20 '24 09:06 arthedza

After discussing this issue with @cortinico, the problem is with broken backward compatibility in libraries, right now for this we have two solutions:

  1. Use React Native 0.71 or 0.72,
  2. Downgrade libraries to the version that contains package field in AndroidManfiest.xml

We'll upstream fixes for this to the older versions (0.69, 0.70) of RN soon.

Hi, were you able to upstream the fix for .69?

captainalbert avatar Jul 16 '24 19:07 captainalbert

我也有这个问题,想问下怎么解决的

ayi12138 avatar Sep 12 '24 08:09 ayi12138

@captainalbert did you find a solution for .69?

christophby avatar Sep 18 '24 16:09 christophby