RePlugin集成Fresco

Fresco版本说明

目前fresco最新版本2.3.0,但无法直接在插件中集成

  • 从1.14开始要求使用AndroidX ,向下选择1.13.0

  • 从1.10.0开始没有armeabi, 向下选择1.9.0

  • 从1.8.0开始强制使用SoLoader,向下选择1.7.1

插件集成Fresco遇到的问题

这里需要重点说明一下SoLoader问题,fresco在1.8.0版本开始,就使用SoLoader替换了SoLoaderShim,原文:

SoLoader has been released for a while now, and updated just last week. We’ve made the decision to add a hard dependency on it and make SoLoader the one and only native code loader that we use in Fresco. API-wise, this means SoLoaderShim is gone. If you were using some other native loading library (e.g. ReLinker), you can either:

keep both and just delete your SoLoaderShim implementation, but this will make your APK size bigger
switch to SoLoader for the rest of your app as well and remove the other dependency

插件中的SoLoader在加载时会使用到一个宿主无权操作的路径:/data/user/0/插件包名/lib-main(但这个路径并不存在!),导致宿主在加载插件时,直接报错,因此插件并不会成功启动。

插件集成Fresco的解决方案

解决办法有2种:

  • 方案1:fresco降级,使用1.7.1版本。

  • 方案2:宿主compile fresco,插件provided fresco。

方案2需要修改fresco源码,因为provided不支持依赖aar,详情见:https://mp.weixin.qq.com/s/ICjLCTWIeHy58ayp_cEvSQ。

方案2示例中没有具体的操作步骤说明,感觉去折腾Fresco的源码也有点麻烦,1.7.1跟1.9.0相差似乎也不是很大。所以,最终选择方案一,在插件工程中集成1.7.1版本的Fresco:

compile "com.facebook.fresco:fresco:1.7.1"

有时间了再回头研究怎么使用方案2集成~

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值