Wondering why this error occurs? If you look closer the image below, you will see two rectangles marked in RED. The Error appears due to the presence of the code blocks (in the small rectangle) inside your Gradle file. All you have to do is simply erase the block from your Gradle File. You will never ever get such an error from the Android Studio after this.

Error(24, 0) Declaring custom 'clean' task when using the standard Gradle lifecycle plugins is not allowed

 

If you are facing any issues feel free to comment it out. We will help you always 🙂