Android Studio 2022.3.1版本 引入包、maven等需要注意的问题

普通包

以前:

复制代码
// 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")
        }
    }
}
相关推荐
冬奇Lab10 小时前
Android触摸事件分发、手势识别与输入优化实战
android·源码阅读
城东米粉儿13 小时前
Android MediaPlayer 笔记
android
Jony_13 小时前
Android 启动优化方案
android
阿巴斯甜13 小时前
Android studio 报错:Cause: error=86, Bad CPU type in executable
android
张小潇13 小时前
AOSP15 Input专题InputReader源码分析
android
_小马快跑_17 小时前
Kotlin | 协程调度器选择:何时用CoroutineScope配置,何时用launch指定?
android
_小马快跑_17 小时前
Kotlin | 从SparseArray、ArrayMap的set操作符看类型检查的不同
android
_小马快跑_17 小时前
Android | 为什么有了ArrayMap还要再设计SparseArray?
android
_小马快跑_17 小时前
Android TextView图标对齐优化:使用LayerList精准控制drawable位置
android
_小马快跑_17 小时前
Kotlin协程并发控制:多线程环境下的顺序执行
android