Androidx和Android support库共存问题解决

技术标签: android studio

Androidx和Android support库不能共存

 

解决方案一 转换成Androidx

  1. 将build tools更新到3.2.0,gradle更新到4.6,依赖库统一更新到28.0.0,这一步非常重要,否则会导致第二步不能完全转换成功。

    image.png


    修改完成后,可以看到依赖库都是28.0.0的

     

     

  2. 选择工程右键→Refactor→Migrate to Androidx...

     

     

  3. 选中所有需要重命名的目录,执行Do Refactor

     

     

  4. 发现已经看不到support库了,运行成功安装app。

 

解决方案二 转换成Android Support

  1. 查看那些库依赖了Androidx,执行gradlew :app:dependencies

    image.png

  2. 发现是第三方库implementation 'com.github.chrisbanes:PhotoView:latest.release'引用了Androidx,登陆其官网https://github.com/chrisbanes/PhotoView

    image.png

  3. 发现刚好9天之前发布了新版本,今天2018-10-9,刚好可以节前可以运行,节后不能运行的疑问。
    找到了问题,果断回退这个依赖库的版本到2.1.4.

     

    image.png

  4. 发现看不到androidx库了,运行成功安装app。

PS:
依赖库的时候,尽量不要使用latest.release,而使用具体的版本。

  1. 不会因为依赖库更新,引起兼容问题;
  2. 减少每次去查找最新版本,可以节省编译时间。**

 

 

PS:

还有小伙伴说在manifest的<application >加上
tools:replace="android:appComponentFactory"
android:appComponentFactory="whateverString"

 

可以试试...

来源:https://www.jianshu.com/p/f7a7a8765294


智能推荐

Android更新到AndroidX库出现的问题

1.部分UI失效了,更新AndroidX之后,发现之前给checkBox设置的button属性在API19版本失效了,变成了最原始的按钮样式,如果: 问题分析: 因为样式问题,所以我尝试屏蔽application文件引用 的主题发现文件恢复了,为什么会是主题引起的呢 因为我的主题引用Theme.AppCompat.Light.NoActionBar这个,这个文件来自于appcompat中,未引用A...

Android中使用AndroidX出现 but the 'android.useAndroidX' property is not enabled的问题解决办法

    当更新了Android Studio之后编译出现了这样的问题:This project uses AndroidX dependencies, but the 'android.useAndroidX' property is not enabled. Set this property to true in the gradle.properties fil...

android listivew和scrollview 并存问题解决方式

在开发中,偶尔会遇到这样的一个问题,就是: 一个页面,上半部分的内容比较多(组合视图),下班部分是一个listview ,甚至有时,最下面还有一些内容(组合视图),如下图: 像这类的界面,在设计上,是不推荐的,但是,有时候,客户就是这么要求的。。。那就没办法了。只能想办法实现了。 思路: 既然页面的上半部分的内容较多,下面还有列表,和其他视图。这样就会导致在小屏幕的手机上,下面的内容显示不出来。一...

Android SSL异常问题解决

文章允许转载,请注明来源:https://blog.csdn.net/feiniao8651/article/details/83715491 背景 一直使用的是阿里云免费的ssl证书,免费的午餐肯定是有一些缺点的,就是有效期只有一年,过每年都要重新申请一次证书。服务器最近证书到期了,换了新的证书到服务器之后,电脑上https访问是正常的,chrome浏览器的地址栏里能看到安全标识。但是在Andr...

Android问题解决02

新建xml启动graphiclayout报错:The SDK layoutlib version is not supported 转载:新建xml启动graphiclayout报错 在上方把api的版本改为了20,没有推出eclipse,只是重新启动了界面,然后可以正常使用了。...

猜你喜欢

Android Studio 乱码问题解决

如今华夏太阳高照, 天气炎热代码烦躁, 开发工具乱码不妙, 还好机智我有妙招, 今天开发过程中遇到了乱码问题,Version Control中的历史记录中文全部被小方块块代替了,效果如下: 各位大佬,小方块,了解一下~ 当时就蒙圈了,立马想到什么UTF-8,各种设置,燃大鹅,并没有什么卵用。工具中搜索类输入中文也是小方块块。 总之世界都很方了 如果你也遇到了这么方的问题,嗯,你可以忽略以上文字。。...

Android Studio 使用问题解决

1. Gradle 、Gradle 插件、Android Studio 版本的互相依赖关系 例如对于Android Studio 3.0.1版本来说,必须保证 Gradleversion 为4.1 Android plugin version 为3.0.1 2. Android Studio 常用快捷键 作用 按键 代码提示 Ctrl + Alt +空格 格式化代码 Ctrl + Alt + L ...

Unity3D之Mecanim动画系统学习笔记(六):使用脚本控制动画

控制人物动画播放 这里我重新弄了一个简单的场景和新的Animator Controller来作为示例。 下面先看看Animator Controller的配置: 人物在站立状态只能进入走路,走路只能进入奔跑或返回站立,奔跑只能进入跳跃或返回走路,跳跃则只能返回奔跑。 参数方面为两个参数: Float类型的moveSpeed; Trigger类型的Jump; 连线直接的转换条件为:moveSpeed...

华为云数据湖工厂服务DLF

1. DLF服务说明 参考官网:https://support.huaweicloud.com/productdesc-dlf/dlf_07_001.html ,数据湖工厂服务(Data Lake Factory,简称DLF)是华为云大数据重要的平台产品,它可管理多种大数据服务,提供一站式的大数据开发环境、全托管的大数据调度能力,极大降低用户使用大数据的门槛,帮助用户快速构建大数据处理中心。 使用...

关于小白学习渗透Billu_box过程

** Billu_box渗透测试 ** 1.1实验环境 靶机:Billu_box IP地址:192.168.237.141 测试机:Kali,IP地址:192.168.237.141; 这里呢先查看自己本身的ip, 1.2实验流程 信息收集——主机发现、端口扫描 由于安装的虚拟机使用的NET模式 ,所以已经知道在同一网段, 实际环境中呢也是肯定要使用相同网段进行渗透测试的,...

问答精选

Sql Query With Select and IF

here is my table description: Table Name : Orders Columns : ID, NO, Quantity, Base, Code First my query should check the value of Code, if value of Code is 'B' then OUTPUT VALUE should be Code+Base if...

EmberJS and web components: extend an existing HTML tag within an initializer (is it possible?)

Edit: this issue only seems to be in the .hbs rendering as this code does work when the extended web component is inserted in the top level index.html of the EmberJS project Edit 2: However, when I pu...

I can't find the error in my socket python program

I was following a socket tutorial and suddenly there was a bug in my code that I couldn't understand or find Can anyone help me find the bug? I referenced with the tutorial code and it doesn't work. T...

Datatables - fixedHeader with scrollX

I am trying to use Datatables with fixedheader (v3) as well as enable horizontal scrolling. Attached is the fiddle http://jsfiddle.net/xF8hZ/344/ . When scrolling the fixedheader width doesn't align w...

meego cannot play mp3 file

I tried to implement SoundEffect from QtMobilityKit in QML to play music file in Meego Harmattan. I found that it can only play .wav file. is there any possible way to play .mp3 file in meego? This on...

相关问题

相关文章

热门文章

推荐文章

相关标签

推荐问答