ERROR: Unsupported method: AndroidProject.getVariantNames().

The problemERROR: Unsupported method: AndroidProject. GetVariantNames ().
The version of Gradle you connect to does not support that method.
to resolve The problem you can change/upgrade The target version of Gradle you connect to.
Alternatively, you can ignore this exception and read other information from the model.

Translation:
Error: doesn’t support method: AndroidProject GetVariantNames ().
The Gradle version connected to does not support this method.
To resolve this problem, you can change/upgrade the target version of the Gradle you connect to.
Alternatively, you can ignore the exception and read additional information from the model.

methods

    1. modify the build.gradle file in the project directory,
classpath "com.android.tools.build:gradle:3.3.2"

In engineering./ Gradle/Wrapper/Gradle-wrapper. Properties, take a look at the address link

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

Gradle sync once;

reference
Relationship between Android Studio and Gradle

    https://developer.android.google.cn/studio/releases/gradle-plugin#updating-gradle

Read More: