Android Studio 添加百分比布局库的依赖报错 第一行代码
16lz
2021-01-23
关于添加百分比布局库的依赖报错,错误如下
Version 28 (intended for Android Pie and below) is the last version of the legacy support library, so we recommend that you migrate to AndroidX libraries when using Android Q and moving forward. The IDE can help with this: Refactor > Migrate to AndroidX… less… (Ctrl+F1)
问题出在Goole使用了新的依赖库,将书中下面代码复制过去
复制之后会出现这样的错误
将 compile 改成 implementation
通过 Refactor 找到下面这个选项
点击 migrate 后再点击 ok
左下角点击Do Refactor
可以看到两处都不在报错了
然后将包名改成
androidx.percentlayout.widget.PercentFrameLayout
更多相关文章
- android 打开摄像头的代码
- Android有用代码片段(一)(二)....
- android计算器简单实现代码
- Android 基础布局控件自定义view使用练习
- 代码获取Android的VersionCode和VersionName信息
- Android加载Gif动画实现代码