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

Could not compile settings file 'F:\myRNproject\android\settings.gradle'. #8570

Closed
wxy1234567890 opened this issue Feb 21, 2019 · 22 comments
Closed

Comments

@wxy1234567890
Copy link

problems as follows:
FAILURE: Build failed with an exception.

  • Where:
    Settings file 'F:\myRNproject\android\settings.gradle' line: 3

  • What went wrong:
    Could not compile settings file 'F:\myRNproject\android\settings.gradle'.

startup failed:
settings file 'F:\myRNproject\android\settings.gradle': 3: unexpected char: '' @ line 3, column 127.
ules\react-native-vector-icons\android')
^

1 error

  • 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 6s
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html

Command failed: gradlew.bat installDebug

Error: Command failed: gradlew.bat installDebug
at checkExecSyncError (child_process.js:616:11)
at Object.execFileSync (child_process.js:634:13)
at runOnAllDevices (F:\myRNproject\node_modules\react-native\local-cli\runAndroid\runAndroid.js:299:19)
at buildAndRun (F:\myRNproject\node_modules\react-native\local-cli\runAndroid\runAndroid.js:135:12)
at isPackagerRunning.then.result (F:\myRNproject\node_modules\react-native\local-cli\runAndroid\runAndroid.js:65:12)
at process._tickCallback (internal/process/next_tick.js:68:7)

@blindpirate
Copy link
Collaborator

settings file 'F:\myRNproject\android\settings.gradle': 3: unexpected char: '' @ line 3, column 127.
ules\react-native-vector-icons\android')

The error message is pretty clear. Please check your settings.gradle file.

@wxy1234567890
Copy link
Author

settings.gradle file:

rootProject.name = 'myRNproject'
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '..\node_modules\react-native-vector-icons\android')

include ':app'

@blindpirate
Copy link
Collaborator

You need to escape \ character.

@wxy1234567890
Copy link
Author

I get it. '' should be replaced by '/' .Thank you very much.

@barmola
Copy link

barmola commented Nov 20, 2019

I already have "/" . in settings.gradle file. i am still facing that error

@usama-zafar
Copy link

Same error as @barmola . All the / slashes are their but still no luck

@barmola
Copy link

barmola commented Nov 24, 2019

Same error as @barmola . All the / slashes are their but still no luck

Actually my error got resolved after following steps:

for me error occurred after installing multiple packages in one npm install l was trying to install react navigation , react-native-gesture-handler,react-native-screen , so i tried to install them one by one, and after installing every package i opened my [project_name]\android folder in Android Studio and rebuild my project after every install and opened cmd inside android folder and ran this command ./gradlew clean after doing this my BUILD was SUCCESSFULL!!!!! This may be confusing but this worked out for me

@barmola
Copy link

barmola commented Nov 24, 2019

the error which you are getting the same error i was also getting,

JDK 13 is not supported by Gradle 6.[above] try to install JDK 8. and then go through the above mentioned steps.

@usama-zafar
Copy link

Yeah I did that recently and it worked for me too.

What didnt work for me was:
1- Migrating to other JDK versions
2- Opening the project in android studio and fixing the errors through auto-correct
3- Adding the "www" in maven { url 'https://jitpack.io' }

Fix:
\yourProjectName\android then write the following command
gradlew clean (if the build is unsuccessful, rewrite the command until its successful)
Then react-native run-android ( make sure your emulator is running else make sure your device is connected with Developer options and USB debugging as ON)

@barmola
Copy link

barmola commented Nov 24, 2019

I also tried 2 and 3 didn't worked for me too.

@ThadeusAjayi
Copy link

./gradlew clean
worked for me

@blindpirate
Copy link
Collaborator

Everyone,

I'm 100% sure that's syntax error in your build script and you need to paste your code here to get help, at least the lines which is reported error by compiler. We can't help you if you only say "same error".

@AZAMIQBAL
Copy link

Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Anyone Help ?

@kimmerchen
Copy link

Same error as @barmola . All the / slashes are their but still no luck****

@ghost
Copy link

ghost commented May 16, 2020

Hello,
I couldn't get any answer here.
I actuallly cloned the working project from other machine.
Hope any help, from experts.
Thanks

@mwangiwambui
Copy link

Hi @toplongguodev, try running the following commands in this order:
-flutter channel stable
-flutter upgrade --force
-flutter pub cache repair
-cd
-flutter clean

I got the same problem when a cloned a project and turns out the problem was the different versions the other user was using.

@sachinr3238
Copy link

Hello,

This is my settings.gradle file
include ':app'
include ':capacitor-cordova-android-plugins'
project(':capacitor-cordova-android-plugins').projectDir = new File('./capacitor-cordova-android-plugins/')

apply from: '../capacitor.settings.gradle'

and I'm getting this error when I build the code
Gradle sync failed: Could not read script 'C:\'MYPROJECTLOCATION'\capacitor.settings.gradle' as it does not exist.

Can anyone help me out with this?

@dnistreanu
Copy link

The issue still occurs. Windows 10

@ravi-kolla
Copy link

gradlew clean worked for me.

@salalhaider
Copy link

Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Anyone Help ?

Anyone????

@trackmystories
Copy link

trackmystories commented Apr 18, 2021

This is an issue with how Gradle is automating the build and the current version of the JDK installed on your machine, follow these steps to fix it, the react native documentation states you need adoptopenjdk8, however you may have other conflicting JDK versions in the same directory.

Step one:

open up your terminal and navigate to /Library/Java/JavaVirtualMachines by typing the following command:

cd /Library/Java/JavaVirtualMachines

after you have done that type ls to see what files are included and take note of the versions.

incase you have one or multiple JDK files present like such:

adoptopenjdk-8.jdk jdk-16.jdk  jdk-8.jdk

then go head and delete them with the following command line :

sudo rm -rf /Library/Java/JavaVirtualMachines/jdk-16.jdk 
 
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk-8.jdk

the only dependency you need is adoptopenjdk-8.jdk as mentioned in the react native docs

however delete that aswell and reinstall it after you have completed these steps:

sudo rm -rf /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk

after you have done so you can check if the files still exist by typing ls

if the files are deleted.

Step 2:

then run the following commands to insure all other links, plugins and files are deleted as-well from your Library:

run the following :

sudo rm -rf /Library/PreferencePanes/JavaControlPanel.prefPane
sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -rf ~/Library/Application\ Support/Oracle/Java

Step 3:

once you have done the following, reinstall the correct jdk as mentioned in the react native docs like so:

brew install --cask adoptopenjdk/openjdk/adoptopenjdk8

https://reactnative.dev/docs/_getting-started-macos-android

this may say adoptopenjdk-8.jdk is already installed, but go ahead and reinstall install it with:

brew reinstall adoptopenjdk8

enter image description here

At this point the error should be resolved and your build should work.

enter image description here

It is important to note that this is a build error, since react native uses Gradle to build automations, the conflicting of multiple jdk versions can cause your build to fail.

please refer to the following documentation:

https://docs.gradle.org/current/userguide/userguide.html

@poojaGupta7888
Copy link

poojaGupta7888 commented Oct 16, 2022

cd /Library/Java/JavaVirtualMachines The system cannot find the path specified in windows
and got same error with ./gradlew clean

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

No branches or pull requests