[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 @ 2020-02-04 14:59  奥卡修罗  阅读(1768)  评论(0编辑  收藏  举报