Guide on how to fix We recommend using a newer Android Gradle plugin to use compileSdk = 34 Warning:
Are you getting the new build warning “We recommend using a newer Android Gradle plugin to use compileSdk = 34” in your Android studio? Then, you are in the right place! In this article, we will discuss the step-by-step solutions on how to resolve the warning.
So without any further ado, Let’s get started!
How to Fix We recommend using a newer Android Gradle plugin to use compileSdk = 34 Warning?
In this section, we will see the step-by-step solutions to fix the build warning. Before that, check whether your compileSdk is 34 in the modules build.gradle
file.
Method 1: Suppress the Warning
Suppressing the warning is not recommended, as it may lead to tons of new issues during version upgrades.
If you still wish to suppress the warning, you can do so by adding the following line to the gradle.properties
file.
android.suppressUnsupportedCompileSdk=34
And Click on “Sync Now” option to sync the gradle file.
Now select “Build” > “Rebuild Project” option to Rebuild the project.
If you have followed the above steps correctly, you should notice that the build is successful without any warnings.
Method 2: Updating Android Gradle Plugin (AGP) Version
You can check the minimum versions of tools for Android API level in AGP Release notes
For the API level 34, the minimum AGP version required is 8.1.1
To update your AGP version, Follow the steps below:
- Click on the “Settings” >> “Project Structure” >> “Project” and update your AGP version.
- If the option is disabled in the project tab, you can update AGP version from “AGP upgrade Assistant“.
- Now Click on “Tools” >> “AGP Upgrade Assistant“
- Update your AGP dependency version to 8.1.1 or above.
- Select the version and Click on “Run Selected Steps” option to upgrade your Android Gradle Plugin to the selected version.
- Now, Select “Build” > “Rebuild Project” option to Rebuild the project.
Congrats! Now the warning has now been successfully removed.
Conclusion:
I hope this article has helped you to fix “We recommend using a newer Android Gradle plugin to use compileSdk = 34 Warning” in your Android studio. If you have any queries, please feel free to ask them in the comment section below.