Android Support庫遷移AndroidX

image.png

正常情況下 在AS工具欄上 點擊一鍵遷移就可以遷移
然后點擊運行 看看有沒有報錯的 一般是會出現(xiàn)報錯的· build-rebuild

  1. AndroidManifest.xml provider 修改為androidx
  <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.fileProvider"
            android:enabled="true"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths"
                tools:replace="android:resource" />
        </provider>
  1. butterknife 一般需要升級到版本10以上
  2. The given artifact contains a string literal with a package reference 'android.support.v4.content' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.

給定的工件包含字符串文字,該文字字符串具有無法安全地重寫的包引用'android.support.v4.content'。使用反射的庫(例如注釋處理器)需要手動更新,以增加對androidx的支持

這里需要注意:反射或者字符串引用到的support 需要自己手動更新 這里是個坑?。?! 特別是反射 一不小心就報錯

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

友情鏈接更多精彩內容