在學習《Android編程權威指南》時,按書中要求添加com.android.support:appcompat的依賴,然后編譯不通過,提示如下問題:
大概意思是,Android Pie之前支持這個庫,我們建議遷移到AndroidX libraries……
然后搜索了一下,原來2018年google開發者大會以后,相關庫已經整合到AndroidX庫中,這里放一個鏈接:(別人的說明)
1. AndroidX變化
1)常用依賴庫對比:
Old build artifact AndroidX 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 class AndroidX 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'
無須再次導入。