当前位置: 首页 > news >正文

gradle 7.0 + 配置

Maven 镜像地址的设置

原来在项目根目录的 build.gradle 中进行设置,但是现在里面只有plugins。

 工程的build.gradle的dependencies修改为plugins,替代了引用原来的Gradle版本。

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {id 'com.android.application' version '7.4.2' apply falseid 'com.android.library' version '7.4.2' apply false
}

想使用旧的依旧可以在项目build.gradle里面按照原来方式添加,不影响旧方法。

buildscript {dependencies {classpath 'com.android.tools.build:gradle:4.1.0'classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30"}
}

或者使用buildscript+plugins同时存在的模式,注意顺序不能错,否则会提示错误的

apply from 自定义配置清单还是能够使用

//注意 buildscript节点有可能没有 自己添加需要注意与plugins的顺序
buildscript {ext {kotlin_version = '1.6.10'}dependencies {classpath 'com.google.dagger:hilt-android-gradle-plugin:2.28-alpha'}
}
plugins {id 'com.android.application' version '7.1.1' apply falseid 'com.android.library' version '7.1.1' apply falseid 'org.jetbrains.kotlin.android' version '1.5.31' apply false
}
//apply from: "config.gradle"//自定义配置清单还是能够使用
task clean(type: Delete) {delete rootProject.buildDir
}

原来工程中 build.gradle 的buildscriptallprojects移动至setting.gradle

改名为pluginManagement 和dependencyResolutionManagement。里面的东西依旧可以按照原来的copy过来。

include 方法还是老样子

pluginManagement {repositories {// 国内镜像maven { url 'https://maven.aliyun.com/repository/google/' }maven { url 'https://maven.aliyun.com/repository/jcenter/' }maven { url 'https://maven.aliyun.com/nexus/content/repositories/releases/' }maven { url 'https://maven.aliyun.com/nexus/content/repositories/central' }maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' }maven { url 'https://maven.aliyun.com/nexus/content/groups/public' }maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' }maven { url 'https://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }google()mavenCentral()gradlePluginPortal()}
}
dependencyResolutionManagement {repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)repositories {// 国内镜像maven { url 'https://maven.aliyun.com/repository/google/' }maven { url 'https://maven.aliyun.com/repository/jcenter/' }maven { url 'https://maven.aliyun.com/nexus/content/repositories/releases/' }maven { url 'https://maven.aliyun.com/nexus/content/repositories/central' }maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' }maven { url 'https://maven.aliyun.com/nexus/content/groups/public' }maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' }maven { url 'https://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }google()mavenCentral()}
}
rootProject.name = "xxxxx"
include ':app'

APP项目下的 build.gradle

 原有的 apply plugin 变更为 plugins,其他的影响不大。

apply plugin: 'com.android.application'
plugins {id 'com.android.application'
}

 

 

http://www.lryc.cn/news/330298.html

相关文章:

  • vue3的ref和reactive对比
  • 是否应该升级到ChatGPT 4.0?深度对比ChatGPT 3.5与4.0的差异
  • C++刷题篇——04找等值元素
  • 2024年最新服装erp软件排名!(建议收藏)
  • Radash一款JavaScript最新的实用工具库,Lodash的平替!
  • 使用node爬取视频网站里《龙珠》m3u8视频
  • 搜索与图论——Prim算法求最小生成树
  • sqlmap基础知识
  • 读《C Primer Plus》
  • 深入理解计算机系统 家庭作业 2.66
  • 【服务端】node.js详细的配置
  • 二、CentOS基础配置(1.网络与包管理)
  • Golang基础-5
  • Mysql数据库:故障分析与配置优化
  • 常见的图像分析算法
  • 朵米3.5客服系统源码,附带系统搭建教程
  • Python 踩坑记
  • 搭建Spark单机版环境
  • 使用Flutter混淆技术保护应用隐私与数据安全
  • ClickHouse初体验
  • 在k8s中部署高可用程序实践和资源治理
  • WebView的使用与后退键处理-嵌入小程序或者 H5 页面
  • 【攻防世界】file_include (PHP伪协议+过滤器)
  • Linux 内核中PHY子系统(网络):PHY驱动
  • 【六 (1)机器学习-机器学习算法简介】
  • TCP服务端主动向客户端发送数据
  • ObjectiveC-03-XCode的使用和基础数据类型
  • YOLOv9改进策略 :主干优化 | 无需TokenMixer也能达成SOTA性能的极简ViT架构 | CVPR2023 RIFormer
  • 원클릭으로 주류 전자상거래 플랫폼 상품 상세 데이터 수집 및 접속 시연 예제 (한국어판)
  • 2024年github开源top100中文