普通包
以前:
// okhttp3
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
新版本:
implementation("com.github.bumptech.glide:glide:3.7.0")
libs文件夹中的包
以前:
android {
***
***
sourceSets.main{
jniLibs.srcDirs = ['src/main/jniLibs','libs']
}
repositories {
flatDir{
dirs 'libs'
}
}
}
新版本:
implementation(fileTree("libs"));
引入maven的区别
以前:
build.gradle(Project:项目名)
buildscript {
repositories {
google()
maven{
url 'http://maven.aliyun.com/nexus/content/groups/public/'
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven{
url 'http://maven.aliyun.com/nexus/content/groups/public/'
}
jcenter()
}
}
新版本:
settings.gradle.kts
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url = uri("https://jcenter.bintray.com") }
}
}
rootProject.name = "ydy"
include(":app")
ndk写法
以前:
android {
***
***
defaultConfig {
***
***
ndk{abiFilters"armeabi","armeabi-v7a"}
}
***
***
}
新版本:
android {
***
defaultConfig {
***
***
ndk {
abiFilters.add("armeabi")
abiFilters.add("arm64-v8a")
abiFilters.add("armeabi-v7a")
abiFilters.add("x86")
}
}
}