久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術(shù)文章
文章詳情頁

Android Studio Gradle 更換阿里云鏡像的方法

瀏覽:159日期:2022-09-22 16:10:09

使用 Android Studio 開發(fā)時(shí)經(jīng)常遇到編譯卡住的問題,原因是 Gradle 下載依賴資源過慢。沒辦法,有長城在,還是得換鏡像。

同樣,這是個(gè)普遍存在的問題,我們希望可以對它進(jìn)行全局配置。在 .gradle (路徑參考 C:Usersusername.gradle )目錄下新增 init.gradle 文件,內(nèi)容如下:

allprojects{ repositories { def ALIYUN_REPOSITORY_URL = ’http://maven.aliyun.com/nexus/content/groups/public’ def ALIYUN_JCENTER_URL = ’http://maven.aliyun.com/nexus/content/repositories/jcenter’ all { ArtifactRepository repo -> if(repo instanceof MavenArtifactRepository){def url = repo.url.toString()if (url.startsWith(’https://repo1.maven.org/maven2’) || url.startsWith(’http://repo1.maven.org/maven2’)) { project.logger.lifecycle 'Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL.' remove repo}if (url.startsWith(’https://jcenter.bintray.com/’) || url.startsWith(’http://jcenter.bintray.com/’)) { project.logger.lifecycle 'Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL.' remove repo} } } maven { url ALIYUN_REPOSITORY_URL url ALIYUN_JCENTER_URL } } buildscript{ repositories { def ALIYUN_REPOSITORY_URL = ’http://maven.aliyun.com/nexus/content/groups/public’ def ALIYUN_JCENTER_URL = ’http://maven.aliyun.com/nexus/content/repositories/jcenter’ all { ArtifactRepository repo ->if(repo instanceof MavenArtifactRepository){ def url = repo.url.toString() if (url.startsWith(’https://repo1.maven.org/maven2’) || url.startsWith(’http://repo1.maven.org/maven2’)) { project.logger.lifecycle 'Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL.' remove repo } if (url.startsWith(’https://jcenter.bintray.com/’) || url.startsWith(’http://jcenter.bintray.com/’)) { project.logger.lifecycle 'Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL.' remove repo }} } maven {url ALIYUN_REPOSITORY_URLurl ALIYUN_JCENTER_URL } } }}

如只需對單個(gè)項(xiàng)目進(jìn)行配置,可以在項(xiàng)目根目錄下的 build.gradle 文件中添加如下代碼:

maven { url ’http://maven.aliyun.com/nexus/content/groups/public/’ }maven { url ’http://maven.aliyun.com/nexus/content/repositories/jcenter’ }maven { url ’http://maven.aliyun.com/nexus/content/repositories/google’ }maven { url ’http://maven.aliyun.com/nexus/content/repositories/gradle-plugin’ }

搞定,下載速度飛起~

到此這篇關(guān)于Android Studio Gradle 更換阿里云鏡像的方法的文章就介紹到這了,更多相關(guān)Android Studio Gradle阿里云內(nèi)容請搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!

標(biāo)簽: Android
相關(guān)文章:
主站蜘蛛池模板: 扶沟县| 丰都县| 宝兴县| 沭阳县| 渝中区| 延庆县| 定襄县| 大兴区| 定兴县| 盈江县| 锡林浩特市| 大埔区| 巧家县| 浦江县| 磴口县| 高雄县| 余庆县| 普陀区| 彭阳县| 松阳县| 高州市| 新绛县| 自治县| 大名县| 保定市| 鄂尔多斯市| 都江堰市| 宣化县| 苗栗县| 庆城县| 保定市| 镇康县| 盐亭县| 商河县| 金华市| 大埔区| 云南省| 襄垣县| 易门县| 苏尼特左旗| 东丽区|