添加之前:

一、在專案上單擊此按鈕

二、Dependencies->app->Library Dependency

三、搜索選擇合適的包后OK

若gradle后還是灰色

選擇project視圖

將gradle.properties的兩個值改為false

切換回android視圖后點擊立刻同步

依賴匯入成功

若在同步時出現incompatible types:required:androidx.fragment.app.fragmentManager…錯誤,在清單檔案中添加:
android:appComponentFactory=""
tools:replace="android:appComponentFactory"
若getSupportFragmentManager()還出現錯誤,注意以下三點:
1.繼承FragmentActivity
2.定義FragmentManager改為android.support.v4.app.FragmentManager
3.將方法getFragmentManager()改為getSupportFragmentManager()

轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/148635.html
標籤:其他
上一篇:Activity記憶體泄漏分析
下一篇:c++ io條件狀態 的一個例子
