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")
        }
    }
}
相关推荐
96245611 小时前
从“一键创建 ECS”到完整恢复状态机:ACK 抢占式节点恢复 Android 工具升级复盘
android
LCD液晶屏14 小时前
京瓷液晶屏停产替代:杭州立煌科技工业 LCD 解决方案
android·科技
2501_9327502615 小时前
Android 自定义 View 入门
android
事圆则缓18 小时前
Android 开启线程的几种方式:Thread、线程池、HandlerThread 与协程
android
oooost19 小时前
Jupyter Notebook 常用快捷键速查
ide·python·jupyter
yqj2341 天前
ESP32-S3中小智项目优化内容
ide·macos·xcode
半摆烂日常1 天前
低代码平台API对接实践:接口鉴权与数据同步的完整实现
android·低代码·rxjava
事圆则缓1 天前
volatile 使用场景全解析:它能保证什么,又解决不了什么
android
蒲公英内测分发1 天前
智能投影仪参加海外展会,未上架的 Android 配套 App 怎么让客户限时试用?
android