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. 🙂


Related Posts

6 thoughts on “Could not Compile Settings File project/android/settings.gradle”

  1. What should i do with this error

    FAILURE: Build failed with an exception.

    * Where:
    Settings file ‘C:\Users\P1\Desktop\react\MyApp\android\settings.gradle’

    * What went wrong:
    Could not compile settings file ‘C:\Users\P1\Desktop\react\MyApp\android\settings.gradle’.
    > startup failed:
    General error during semantic analysis: Unsupported class file major version 57

    Reply

Leave a Comment

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