cli: @react-native-community/cli-platform-android Build Failed: The current character read is 'i' with an int value of 105
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.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 8
- Comments: 32 (2 by maintainers)
For me it was caused by
react-native-image-picker
. Updating it fixed itIm also facing the same issue… is there any fix yet for this ? Thanks
I am also facing this issue with no solution
@nhokmoon , did you fix the issue? i’ve been stuck for days now.
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.
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.
BUILD FAILED in 2s
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.
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
1.rm -fr node_modules 2.yarn install 3.yarn react-native run-android
@szymonrybczak something to add to #1983 ?
Hello 👋 This is probably not issue related to React Native CLI - but related to libraries, please try upgrading (such as react-native-image-picker or react-native-cameraroll or any other) - probably in these libraries were introduced breaking change that breaks your app. Please also try creating fresh React Native app with
npx react-native@latest init
command and say is it working for you correctly.When did this error start for you? I’ve tried rolling back to previous commits and re-cloning to an earlier version of the app I’m still facing the same error.
Could you talk me through you clean install process please?
i’m experiencing the same issue since upgrading a dependency. I’ve also tried a clean install, downgrading the dependencies, further upgrading them but i can’t the app running. (Can also confirm this on various apps)