[android]com.android.support:appcompat-v7:XXX 包导入无法Build

在学习《Android编程权威指南》时,按书中要求添加com.android.support:appcompat的依赖,然后编译不通过,提示如下问题:

大概意思是,Android Pie之前支持这个库,我们建议迁移到AndroidX libraries……

然后搜索了一下,原来2018年google开发者大会以后,相关库已经整合到AndroidX库中,这里放一个链接:(别人的说明)

1. AndroidX变化

1)常用依赖库对比:

Old build artifactAndroidX build artifact
com.android.support:appcompat-v7:28.0.2 androidx.appcompat:appcompat:1.0.0
com.android.support:design:28.0.2 com.google.android.material:material:1.0.0
com.android.support:support-v4:28.0.2 androidx.legacy:legacy-support-v4:1.0.0
com.android.support:recyclerview-v7:28.0.2 androidx.recyclerview:recyclerview:1.0.0
com.android.support.constraint:constraint-layout:1.1.2 androidx.constraintlayout:constraintlayout:1.1.2

 更多详细变化内容,可以下载CSV格式映射文件;

2)常用支持库类对比:

Support Library classAndroidX class
android.support.v4.app.Fragment androidx.fragment.app.Fragment
android.support.v4.app.FragmentActivity androidx.fragment.app.FragmentActivity
android.support.v7.app.AppCompatActivity androidx.appcompat.app.AppCompatActivity
android.support.v7.app.ActionBar androidx.appcompat.app.ActionBar
android.support.v7.widget.RecyclerView androidx.recyclerview.widget.RecyclerView

 更多详细变化内容,可以下载CSV格式映射文件。



作者:翻译不了的声响
链接:https://www.jianshu.com/p/7dc111353328
来源:简书

其实android studio3.5里已经内置了这个库:

implementation 'androidx.appcompat:appcompat:1.1.0'

无须再次导入。

posted @   奥卡修罗  阅读(1822)  评论(0编辑  收藏  举报
编辑推荐:
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
点击右上角即可分享
微信分享提示