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")
        }
    }
}
相关推荐
雨白2 小时前
Android 两种拖拽 API 详解:ViewDragHelper 和 OnDragListener 的原理与区别
android
元亓亓亓2 小时前
JavaWeb--day3--Ajax&Element&路由&打包部署
android·ajax·okhttp
return(b,a%b);2 小时前
VSCode 远程开发连接(glibc<2.28)
ide·vscode·编辑器
speop2 小时前
vscode使用tmux技巧
ide·vscode·编辑器
居然是阿宋2 小时前
Android XML属性与Jetpack Compose的对应关系(控件基础属性篇)
android
GoatJun2 小时前
Android ScrollView嵌套RecyclerView 导致RecyclerView数据展示不全问题
android
潜龙95272 小时前
第6.2节 Android Agent开发<二>
android·python·覆盖率数据
网安Ruler4 小时前
代码审计-PHP专题&原生开发&SQL注入&1day分析构造&正则搜索&语句执行监控&功能定位
android
理想国的女研究僧4 小时前
Jupyter Notebook操作指南(1)
ide·python·学习·jupyter
paid槮5 小时前
MySql基础:数据类型
android·mysql·adb