Could not Compile Settings File project/android/settings.gradle

While building and installing the app you can face a compilation app that is  Could not Compile Settings File in project/android/settings.gradle. This problem often comes when you link a project dependency in the windows machine and try to run it on Emulator/Device (especially after linking react-native-gesture-handler).

Problem

After linking any dependency when we build the project:

Build failed with an exception Could not Compile Settings File ‘project/android/settings.gradle’.

Solution

To solve this problem you need to open the project/android/settings.gradle file and have to replace the backslash(\) with the frontslash(/) as windows directory structure do not support the backslash(\).

Before Changes

rootProject.name = 'NavigationExample'
include ':react-native-gesture-handler'
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '..\node_modules\react-native-gesture-handler\android')
include ':app'

After Changes

rootProject.name = 'NavigationExample'
include ':react-native-gesture-handler'
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
include ':app'

This is how you can solve the problem “Could not Compile Settings File project/android/settings.gradle”. If you have any doubts or you want to share something about the topic you can comment below or contact us here.

Hope you liked it. 🙂

1 thought on “Could not Compile Settings File project/android/settings.gradle”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.