Android Studio下载gradle慢问题处理

前言

有时候我们拿到一个Android工程,但是本机没有其所用的gradle版本,AS下载很慢甚至不能正常下载

一、下载gradle

用AS打开工程代码,发现gradle下载很慢,是在让人捉鸡。
看一下gradle版本:

在这里插入图片描述
果然本地没有这个版本的。
果断下一个, 链接在这。记得下载需要的版本…

二、导入gradle

打开gradle目录,因为上面打开过工程,并且AS自动下载gradle,所以该目录下已有此版本的文件夹。

在这里插入图片描述
将下好的gradle考进去

在这里插入图片描述
我这里有其他的文件是因为成功引用这个版本后生成的,第一次用的话都删除即可。

三、安排镜像

将国内镜像加到build.gradle中,直接替换原来的就可以

buildscript {
   repositories {
       maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
       maven { url "https://jitpack.io" }
       maven { url 'https://maven.aliyun.com/repository/google' }
       maven { url 'https://maven.aliyun.com/repository/jcenter' }
       maven { url 'https://jcenter.bintray.com' }
       google()
   }
}

allprojects {
   repositories {
       maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
       maven { url 'https://jcenter.bintray.com' }
       maven { url 'https://maven.aliyun.com/repository/google' }
       maven { url 'https://maven.aliyun.com/repository/jcenter' }
       mavenCentral()
       jcenter()
   }
}

四、加载工程

在这里插入图片描述
上面两种方式都可以。速度很快的。

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
About This Book, Create custom Gradle tasks and plugins for your Android projects, Configure different build variants, each with their own dependencies and properties, Manage multi-module projects, and integrate modules interdependently, Who This Book Is For, If you are an experienced Android developer wanting to enhance your skills with the Gradle Android build system, then this book is for you. As a prerequisite, you will need some knowledge of the concepts of Android application development., What You Will Learn, Build new Android apps and libraries using Android Studio and Gradle, Migrate projects from Eclipse to Android Studio and Gradle, Manage the local and remote dependencies of your projects, Create multiple build variants, Include multiple modules in a single project, Integrate tests into the build process, Create custom tasks and plugins for Android projects, In Detail, Gradle is an open source build automation system that introduces a Groovy-based domain-specific language (DSL) to configure projects. Using Gradle makes it easy for Android developers to manage dependencies and set up the entire build process., This book begins by taking you through the basics of Gradle and how it works with Android Studio. Furthermore, you will learn how to add local and remote dependencies to your project. You will work with build variants, such as debug and release, paid and free, and even combinations of these things. The book will also help you set up unit and integration testing with different libraries and will show how Gradle and Android Studio can make running tests easier. Finally, you will be shown a number of tips and tricks on the advanced customization of your application's build process. By the end of this book, you will be able to customize the entire build process, and create your own tasks and plugins for your Gradle builds.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

树上灵溪

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值