赞
踩
很久没有写Android项目,最近搭建Android环境,安装AndroidStudio后需要自动下载各种依赖,公司网络环境屏蔽了Google的各种地址。网络上找各种文章说的也都不很清楚,要么模棱两可,要不贴了一部分代码。这里放一个完整的说明。
修改项目根目录下得settings.gradle
修改方式如下图,红框内为新增的,一定要放在最前面!!!!!!!!
代码放在这里,方便各位大佬复制
pluginManagement { repositories { maven { url 'http://公司的maven地址' allowInsecureProtocol = true } maven { url 'https://maven.aliyun.com/repository/public' } maven { url 'https://maven.aliyun.com/repository/public' } maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/gradle-plugin' } gradlePluginPortal() google() mavenCentral() } plugins { id 'com.android.application' version '7.1.0-alpha11' id 'com.android.library' version '7.1.0-alpha11' } } dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { maven { url 'http://公司的maven地址' allowInsecureProtocol = true } maven { url 'https://maven.aliyun.com/repository/public' } maven { url 'https://maven.aliyun.com/repository/public' } maven { url 'https://maven.aliyun.com/repository/google' } maven { url 'https://maven.aliyun.com/repository/gradle-plugin' } google() mavenCentral() } } rootProject.name = "你的app名称" include ':app'
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。