‘Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0'

Des
3 min readMay 3, 2023

--

Gradle error log

Gradle is an open-source build automation tool flexible enough to build almost any type of software. Gradle’s job is to resolve the dependency tree of your application and run everything through the Java compiler to generate code that can be run in the Java Virtual Machine (JVM). In React Native it comes as a plugin which is distributed as a separate plugin that gets automatically installed when you create/build your project newly.

Disclaimer: this fix particularly solves the problem in relations to a react native project. Although it might help in an actual Android or Flutter project, so take the risk and succeed 😁.

A gradle wrapper is important to use, as it executes the Gradle build (which is recommended), it is a script that invokes a declared version of Gradle, downloading it beforehand if necessary and help developers to run any project of theirs that uses Gradle without having to handle too much technicalities.

Method 1

Open your terminal and cd to your project directory

cd [projectname]

then

cd android

check your Gradle version with

./gradlew -v

this will give not only the Gradle version but the JVM and Kotlin etc version information as well (if you do not have jdk installed or using a version below 11, please update to JDK 11 here as it is recommended). If your Gradle version is 8.0, navigate from your project to android -> gradle -> wrapper -> gradle-wrapper.properties, open this file and locate

distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip

change the version number to

distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip

This version is more compatible with our android build since RN from version 0.69+ has compatibility issues with the Gradle setup.

The above tweak will download Gradle version 7.5 upon saving the file and cleaning using

./gradlew clean 

Method 2

Using the terminal, change to the android directory to install the intended version (7.5 recommended) using

gradle wrapper --gradle-version x.x

x = version number. After this do a ./gradlew clean and run your project

The above methods also fix the `>Task: react-native-gradle-plugin:Compile` problem, if it applies to you.

A high possibility will be that upon running the app, it will throw (not limited to) an error like

, cd to the android directory and run

./gradlew build --warning-mode all

or expand your terminal (in full screen mode), to get a full log of the error, trace the error in the project directory and make the necessary change(s), save then rerun your app.

This is somewhat painstaking to solve but with this article, hopefully the issue(s) gets resolved. Do comment with any material that you used/found and deem useful.

Thank you.

--

--

Des

•Lifestyle by day 🌝• {coder} by night 🌚• Socials - @deksmond•