文章目录

  • 换阿里源
  • 方法二(待测)
  • 换源

换阿里源

  1. 对特定项目生效,在项目中的build.gradle修改内容
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {repositories {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' }}dependencies {classpath "com.android.tools.build:gradle:4.2.2"// NOTE: Do not place your application dependencies here; they belong// in the individual module build.gradle files}
}allprojects {repositories {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' }}
}task clean(type: Delete) {delete rootProject.buildDir
}
  1. 对所有项目生效
    C:\Users\Administrator\.gradle下创建init.gradle文件
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')) {project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL."remove repo}if (url.startsWith('https://jcenter.bintray.com/')) {project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL."remove repo}}}maven {url ALIYUN_REPOSITORY_URLurl ALIYUN_JCENTER_URL}}
}

方法二(待测)

换源

build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {repositories {google()jcenter()maven { url 'https://jitpack.io' }}dependencies {classpath "com.android.tools.build:gradle:4.0.1"classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.10'// 资源混淆插件:https://github.com/shwenzhang/AndResGuardclasspath 'com.tencent.mm:AndResGuard-gradle-plugin:1.2.17'// NOTE: Do not place your application dependencies here; they belong// in the individual module build.gradle files}
}allprojects {repositories {google()jcenter()maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }maven { url 'https://maven.aliyun.com/nexus/content/repositories/central/' }maven { url 'https://dl.bintray.com/getactivity/maven/' }maven { url 'https://dl.bintray.com/umsdk/release' }maven { url 'https://maven.google.com' }maven { url 'https://jitpack.io' }}
}task clean(type: Delete) {delete rootProject.buildDir
}

config.gradle

// 通用配置
android {compileSdkVersion 31defaultConfig {minSdkVersion 16targetSdkVersion 31versionName '1.0'versionCode 10}// 支持 Java JDK 8compileOptions {targetCompatibility JavaVersion.VERSION_1_8sourceCompatibility JavaVersion.VERSION_1_8}// 设置存放 so 文件的目录sourceSets {main {jniLibs.srcDirs = ['libs']}}
}dependencies {// 依赖 libs 目录下所有 jar 包implementation fileTree(include: ['*.jar'], dir: 'libs')// 依赖 libs 目录下所有 aar 包implementation fileTree(include: ['*.aar'], dir: 'libs')// 谷歌兼容库:https://developer.android.google.cn/jetpack/androidx/releases/appcompat?hl=zh-cnimplementation 'androidx.appcompat:appcompat:1.3.0-alpha01'implementation 'com.google.android.material:material:1.3.0-alpha01'
}

参考文章:
https://www.cnblogs.com/qianmaoliugou/p/12369654.html

Android Stdio换源以及配置项目相关推荐

  1. Android 7.0 源码分析项目一期竣工啦

    从 Android 入行开始,因为工作需求和解决疑难bug的原因陆陆续续的看过一些源码,但都不成系统,从2016年年底开始,在Github上建了一个Android Open Source Projec ...

  2. windows子系统Ubuntu18.04LTS换源及配置grpc编译环境

    Ubuntu18.04LTS更改apt源为阿里云源 1.备份源文件 $ sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak 2.修改源文件 ...

  3. 【六祎-linux】安装linux必须干的事情-换源

    CentOS 镜像(来自阿里巴巴镜像站) 换源步骤 配置方法 1. 备份 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Ba ...

  4. Android Studio新手–下载安装配置–零基础入门–基本使用–调试技能–构建项目基础–使用AS应对常规应用开发

    转自:http://blog.csdn.net/yanbober/article/details/45306483 目标:Android Studio新手–>下载安装配置–>零基础入门–& ...

  5. 大疆妙算Manifold刷机换源,cuda,opencv,qt配置以及实现opencv读取usb摄像头,qmake nvcc交叉编译

    大疆妙算Manifold刷机换源,cuda,opencv,qt配置以及实现opencv读取usb摄像头,qmake nvcc交叉编译 一.刷机 1.解压安装包 2.制作镜像 3.然后按照妙算说明书进入 ...

  6. 树莓派新手入门:烧录系统、换源、基础配置、putty或vnc远程连接

    文章目录 前言 一.什么是树莓派? 二.硬件材料准备 三.下载操作系统 四.系统烧录到TF卡 五.配置树莓派 六.VNC远程连接树莓派,使用图形界面 前言 本篇文章给大家介绍新手如何上手和使用树莓派, ...

  7. 配置maven及其换源

    一.配置maven: 1.从官网上下载你所需要的maven的版本 官网:http://maven.apache.org/download.cgi 2.解压并配置环境变量 ①在系统变量中设置MAVEN_ ...

  8. 【Android FFMPEG 开发】音视频基础 和 FFMPEG 编译 ( 音视频基础 | MPEG-4 标准 | Android 开发环境 | FFMPEG 交叉编译 | 安卓项目导入配置 )

    本篇博客代码及资源下载 : https://download.csdn.net/download/han1202012/10382762 文章目录 一. 音视频基础 1. 音频基础 (1) 声音要素 ...

  9. Ubuntu 18.04 配置 国内 apt-get 换源

    文章目录 Ubuntu 18.04 配置 国内 apt-get 换源 1 备份文件 2 用vim进入并编辑文件 3 进入网站 https://mirrors.tuna.tsinghua.edu.cn/ ...

最新文章

  1. 《细胞》:打破百年生物学法则,记忆可以遗传给下一代,甚至可能跨越多代...
  2. 10条影响CSS渲染速度的写法与建议
  3. 【机器学习】干货!机器学习中 5 种必知必会的回归算法!
  4. python中xlwt的局限,Python xlwt 生成Excel和设置特定单元格不可编辑
  5. MS SQL 模仿ORACLE的DESC
  6. 前端学习(2374):技术栈的使用
  7. TextRank算法原理和提取关键词的主要过程详解 计算句子相似度 计算句子重要性公式
  8. Web前端开发工程师必读de设计博客
  9. debug没反应 eclipse_解决eclipse无法运行或调试的办法
  10. Redis 菜鸟教程学习笔记- Redis 命令- Key
  11. timesat数据如何读取_【续篇】如何通过HART协议将流量计实时数据读取到上位机(文末有彩蛋)...
  12. 一天完成写出一篇毕业设计论文(2020年版本)
  13. word 分栏后转html,word分栏后怎么到另一栏
  14. Policy Gradient (PG)与Proximal Policy Optimization (PPO)算法详解
  15. Lintcode 1667.石头
  16. 生活常用的塑料材质1到7
  17. 如何打开电脑c语言窗口,C语言控制台窗口图形界面编程(五). -电脑资料
  18. DirectX11:着色器
  19. 企业项目文档库管理系统推荐
  20. 在线语音合成 5-1

热门文章

  1. HoloLens开发手记 - 手势输入 Gesture input
  2. 2012_02_07
  3. Excahange2007邮件收件人的管理
  4. windows常见的运行命令以及各快捷键组合
  5. C#的修饰符作用的范围
  6. Perl 连接 SQL Server(ReShip)
  7. 汇编语言对显存直接输出字符串
  8. JS一起学04:函数返回值、定时器、随机数、自动播放的幻灯片
  9. Android使用ViewFlipper实现左右滑动效果面
  10. next_permutation函数