当前位置:网站首页>ARouter 最新问题合集
ARouter 最新问题合集
2022-06-30 10:38:00 【黄毛火烧雪下】
一、“W/ARouter::: ARouter::No postcard![ ]”
这个Log正常的情况下也会打印出来,如果您的代码中没有实现DegradeService和PathReplaceService的话,因为ARouter本身的一些功能也依赖 自己提供的Service管理功能,ARouter在跳转的时候会尝试寻找用户实现的PathReplaceService,用于对路径进行重写(可选功能),所以如果您没有 实现这个服务的话,也会抛出这个日志
推荐在app中实现DegradeService、PathReplaceService
二、 “W/ARouter::: ARouter::There is no route match the path [/xxx/xxx], in group [xxx][ ]”
通常来说这种情况是没有找到目标页面,目标不存在
如果这个页面是存在的,那么您可以按照下面的步骤进行排查
检查目标页面的注解是否配置正确,正确的注解形式应该是 (@Route(path=“/test/test”), 如没有特殊需求,请勿指定group字段,废弃功能)
检查目标页面所在的模块的gradle脚本中是否依赖了 arouter-compiler sdk (需要注意的是,要使用apt依赖,而不是compile关键字依赖)
检查编译打包日志,是否出现了形如 ARouter:: Compiler >>> xxxxx 的日志,日志中会打印出发现的路由目标
启动App的时候,开启debug、log(openDebug/openLog), 查看映射表是否已经被扫描出来,形如 D/ARouter::: LogisticsCenter has already been loaded, GroupIndex[4],GroupIndex > 0
三、开启InstantRun之后无法跳转(高版本Gradle插件下无法跳转)?
因为开启InstantRun之后,很多类文件不会放在原本的dex中,需要单独去加载,ARouter默认不会去加载这些文件,因为安全原因,只有在开启了openDebug之后 ARouter才回去加载InstantRun产生的文件,所以在以上的情况下,需要在init之前调用openDebug
四、 TransformException:java.util.zip.ZipException: duplicate entry …
ARouter有按组加载的机制,关于分组可以参考 6-1 部分,ARouter允许一个module中存在多个分组,但是不允许多个module中存在相同的分组,会导致映射文件冲突
五、Kotlin类中的字段无法注入如何解决?
首先,Kotlin中的字段是可以自动注入的,但是注入代码为了减少反射,使用的字段赋值的方式来注入的,Kotlin默认会生成set/get方法,并把属性设置为private 所以只要保证Kotlin中字段可见性不是private即可,简单解决可以在字段上添加 @JvmField
六、 通过URL跳转之后,在intent中拿不到参数如何解决?
需要注意的是,如果不使用自动注入,那么可以不写 ARouter.getInstance().inject(this),但是需要取值的字段仍然需要标上 @Autowired 注解,因为 只有标上注解之后,ARouter才能知道以哪一种数据类型提取URL中的参数并放入Intent中,这样您才能在intent中获取到对应的参数
七、新增页面之后,无法跳转?
ARouter加载Dex中的映射文件会有一定耗时,所以ARouter会缓存映射文件,直到新版本升级(版本号或者versionCode变化),而如果是开发版本(ARouter.openDebug()), ARouter 每次启动都会重新加载映射文件,开发阶段一定要打开 Debug 功能
边栏推荐
- Android 开发面试真题进阶版(附答案解析)
- LVGL 8.2 Drop down in four directions
- How can the sports app keep the end-to-side background alive to make the sports record more complete?
- 微信推出图片大爆炸功能;苹果自研 5G 芯片或已失败;微软解决导致 Edge 停止响应的 bug|极客头条...
- LVGL 8.2 Image
- pytorch 笔记 torch.nn.BatchNorm1d
- Agile Development: super easy to use bucket estimation system
- OLAP数据库引擎如何选型?
- Unity Shader - 踩坑 - BRP 管线中的 depth texture 的精度问题(暂无解决方案,推荐换 URP)
- Didi open source agile test case management platform!
猜你喜欢

Android 开发面试真题进阶版(附答案解析)

Jetpack Compose DropdownMenu跟随手指点击位置显示

第一届中国数字藏品大会即将召开
![[STL source code analysis] container (to be supplemented)](/img/69/0c6e0e8ecb3ebc8c9b8503f5a8b4e5.jpg)
[STL source code analysis] container (to be supplemented)

19:00 p.m. tonight, knowledge empowerment phase 2 live broadcast - control panel interface design of openharmony smart home project

DQN笔记

The number of users of the home-made self-developed system exceeded 400million, breaking the monopoly of American enterprises, and Google repented

Google 辟谣放弃 TensorFlow,它还活着!
![[deep learning] common methods for deep learning to detect small targets](/img/c6/8f0549864992a1554397bad16dad4d.jpg)
[deep learning] common methods for deep learning to detect small targets

File sharing server
随机推荐
Pytorch notes: validation, model eval V.S torch. no_ grad
LVGL 8.2 Checkboxes as radio buttons
LVGL 8.2 menu from a drop-down list
File sharing server
sCrypt 中的 ECDSA 签名验证
LVGL 8.2 re-coloring
[rust daily] the first rust monthly magazine on January 22, 2021 invites everyone to participate
Every time I look at my colleagues' interface documents, I get confused and have a lot of problems...
List介绍
无心剑中译狄金森《灵魂择其伴侣》
文件共享服务器
国产自研系统的用户突破4亿,打破美国企业的垄断,谷歌后悔不迭
go-zero微服务实战系列(八、如何处理每秒上万次的下单请求)
深潜Kotlin协程(十六):Channel
SQL必需掌握的100个重要知识点:使用存储过程
电化学氧气传感器寿命、工作原理及应用介绍
LVGL 8.2 Simple Image button
LVGL 8.2 Image styling and offset
Double-DQN笔记
From introduction to mastery of MySQL 50 lectures (32) -scylladb production environment cluster building