Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0 while installing react-native-geolocation-services

54 views Asked by At

When executing the command npm i react-native-geolocation-service, I encountered an error related to deprecated Gradle features. The error specifically mentions incompatibility with Gradle 8.0. As a result, I'm unable to proceed with the installation process smoothly, particularly concerning the configuration required to enable GPS permissions for geolocation services.

Why this error occurs during the installation of react-native-geolocation-service? Additionally, could you provide detailed instructions on how to modify the project's configuration files to ensure compatibility with Gradle 8.0 and facilitate the setup of geolocation services?

1

There are 1 answers

0
Nimit On

To address this issue and ensure compatibility with Gradle 8.0, several steps need to be taken within the Android project's configuration files.

Modify android/build.gradle: Inside the buildscript block, add the following line:

buildscript { ext { playServicesLocationVersion = "21.0.1" } }

Update settings.gradle: Add the following block to settings.gradle:

dependencyResolutionManagement {
    repositories {
        maven { url "https://jitpack.io" }
    }
}

Ensure Proper Versioning: It's crucial to verify that the specified playServicesLocationVersion matches the version required by react-native-geolocation-service and other dependencies. Always refer to the official documentation or repository of each library to confirm compatibility and version requirements.

The error message indicates that deprecated Gradle features were utilized in the build, rendering it incompatible with Gradle 8.0. This issue arises due to the reliance on outdated Gradle features or conflicting dependencies.

By adding playServicesLocationVersion within the buildscript block in android/build.gradle, we explicitly define the version of Google Play Services Location that our project should use. This ensures compatibility and resolves conflicts.

Additionally, configuring settings.gradle to include the JitPack repository allows Gradle to fetch necessary dependencies from this repository, which may contain updated versions or fixes for compatibility issues.