赞
踩
setting.gradle.kts
文件kotlin
文件maven { url=uri ("https://www.jitpack.io")}
maven { url=uri ("https://maven.aliyun.com/repository/releases")}
maven { url=uri ("https://maven.aliyun.com/repository/google")}
maven { url=uri ("https://maven.aliyun.com/repository/central")}
maven { url=uri ("https://maven.aliyun.com/repository/gradle-plugin")}
maven { url=uri ("https://maven.aliyun.com/repository/public")}
pluginManagement { repositories { maven { url=uri ("https://www.jitpack.io")} maven { url=uri ("https://maven.aliyun.com/repository/releases")} maven { url=uri ("https://maven.aliyun.com/repository/google")} maven { url=uri ("https://maven.aliyun.com/repository/central")} maven { url=uri ("https://maven.aliyun.com/repository/gradle-plugin")} maven { url=uri ("https://maven.aliyun.com/repository/public")} google() mavenCentral() gradlePluginPortal() } } dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { maven { url=uri ("https://www.jitpack.io")} maven { url=uri ("https://maven.aliyun.com/repository/releases")} maven { url=uri ("https://maven.aliyun.com/repository/google")} maven { url=uri ("https://maven.aliyun.com/repository/central")} maven { url=uri ("https://maven.aliyun.com/repository/gradle-plugin")} maven { url=uri ("https://maven.aliyun.com/repository/public")} google() mavenCentral() } } rootProject.name = "HelloWorld" include(":app")
maven { url "https://jitpack.io" }
maven { url 'https://maven.aliyun.com/repository/releases' }
maven { url 'https://maven.aliyun.com/repository/jcenter' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url 'https://maven.aliyun.com/repository/public' }
pluginManagement { repositories { maven { url "https://jitpack.io" } maven { url 'https://maven.aliyun.com/repository/releases' } maven { url 'https://maven.aliyun.com/repository/jcenter' } maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/central' } maven { url 'https://maven.aliyun.com/repository/gradle-plugin' } maven { url 'https://maven.aliyun.com/repository/public' } google() mavenCentral() gradlePluginPortal() } } dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { maven { url "https://jitpack.io" } maven { url 'https://maven.aliyun.com/repository/releases' } maven { url 'https://maven.aliyun.com/repository/jcenter' } maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/central' } maven { url 'https://maven.aliyun.com/repository/gradle-plugin' } maven { url 'https://maven.aliyun.com/repository/public' } google() mavenCentral() } } rootProject.name = "EasyUtils" include ':app'
pluginManagement
和dependencyResolutionManagement
里面的repositories
都需要填写gradle
文件的url
格式不一样1、东软信息学院
mirrors.neusoft.edu.cn 端口:80
2、北京化工大学
ubuntu.buct.edu.cn/ubuntu.buct.cn 端口:80
3、中国科学院开源协会
mirrors.opencas.cn (mirrors.opencas.org/mirrors.opencas.ac.cn) 端口:80
4、上海GDG镜像服务器
sdk.gdgshanghai.com 端口:8000
5、电子科技大学
mirrors.dormforce.net 端口:80
打开左上角File
==> setting
==> HTTP Proxy
然后填入镜像地址
腾讯: https://mirrors.cloud.tencent.com/AndroidSDK/
阿里: https://mirrors.aliyun.com/android.googlesource.com/
Apply
==> OK
Plugin [id: ‘com.android.application‘, version: ‘x.x.x‘, apply: false] was not found ......
解决办法
查看一下你的gradle对应的JDK版本是否过低,目前8.0版本对应的是JDK17.
检验cmd输入java --version
查看的版本是否与下载的版本一致
查看环境变量中是否有其他版本的 jdk
版本
查看android studio
的gradle
是否使用的相同版本的jdk
)
解决办法
C:\Users\用户名\.gradle
文件夹下的gradle.properties
文件,直接删掉/注释掉最后几行的代理信息Android Studio Unexpected tokens (use ; to separate expressions on the same line)
原因:
解决办法:
setting.gradle
文件中的仓库从旧式格式改为新式kotlin
格式:maven { url=uri("https://www.jitpack.io")}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。