'Build Gradle Error Could not get unknown property 'compile'

i have react native porject when run android this error showed

Build file 'C:\dev\icnet_final\android\app\build.gradle' line: 213

A problem occurred evaluating project ':app'.

Could not get unknown property 'compile' for configuration container of type org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.



Solution 1:[1]

I got this error because I upgraded to the latest version of Gradle. I suggest not doing this yet, until React Native has been updated to work with it.

I changed my version of Gradle in android/build.gradle to the old version and the project built again. This version now works for me:

    classpath('com.android.tools.build:gradle:4.2.2')

Solution 2:[2]

RN 0.64.1 For the dependence, I use

    classpath('com.android.tools.build:gradle:7.0.0')

and for the wrapper

    distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 disconnectionist
Solution 2 Dharman