1、如果是Gradle升级后出现这个问题,那么可能是gradle设置代理导致,在C盘:用户/用户名/目录下找到.gradle文件夹里的gradle.properties 文件注释掉prox使用即可
## For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Thu May 16 15:56:05 CST 2019
#systemProp.https.proxyPort=80
#systemProp.http.proxyHost=mirrors.neusoft.edu.cn
#systemProp.https.proxyHost=mirrors.neusoft.edu.cn
#systemProp.http.proxyPort=80
2、Maybe you should make project clean (Build -> Clean Project
) or clear Android Studio cache (File -> Invalidate Caches / Restart -> Invalidate and Restart
)
3、如果是导入module导致的,将导入module的 build.gradle 第一行
apply plugin: 'com.android.application'
改为
apply plugin: 'com.android.library'
”