当前位置:网站首页>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 功能
边栏推荐
- Every time I look at my colleagues' interface documents, I get confused and have a lot of problems...
- Qt之实现动效导航栏
- 59 websites programmers need to know
- Dell et Apple, deux entreprises de PC établies, se sont effondrées rapidement
- Memory escape analysis
- 8行代码实现快速排序,简单易懂图解!
- Jetpack Compose DropdownMenu跟随手指点击位置显示
- LVGL 8.2 Image
- pytorch 笔记 torch.nn.BatchNorm1d
- Mysql database foundation: constraint and identification columns
猜你喜欢

Retest the cloud native database performance: polardb is still the strongest, while tdsql-c and gaussdb have little change

Dell et Apple, deux entreprises de PC établies, se sont effondrées rapidement

小程序中读取腾讯文档的表格数据

我们公司使用 7 年的这套通用解决方案,打通了几十个系统,稳的一批!

nvm、nrm、npx使用(安装、基本命令、参数、curl、wget)

国产自研系统的用户突破4亿,打破美国企业的垄断,谷歌后悔不迭
![200000 bonus pool! [Alibaba security × ICDM 2022] the risk commodity inspection competition on the large-scale e-commerce map is in hot registration](/img/0e/19c4c97a582d7b2ad08ce806d7af03.jpg)
200000 bonus pool! [Alibaba security × ICDM 2022] the risk commodity inspection competition on the large-scale e-commerce map is in hot registration

matplotlib 笔记: contourf & contour

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

DQN笔记
随机推荐
DQN笔记
The intelligent DNA molecular nano robot model is coming
LVGL8.2 Simple Checkboxes
Deep dive kotlin Xie Cheng (17): Actor
pytorch 笔记 torch.nn.BatchNorm1d
go语言defer
LVGL 8.2 Simple Colorwheel
Dickinson's soul chooses its companion
【STL源码剖析】迭代器
LVGL 8.2 menu from a drop-down list
19:00 p.m. tonight, knowledge empowerment phase 2 live broadcast - control panel interface design of openharmony smart home project
LVGL 8.2 Simple Image button
File sharing server
Anhui "requirements for design depth of Hefei fabricated building construction drawing review" was printed and distributed; Hebei Hengshui city adjusts the pre-sale license standard for prefabricated
Mysql database foundation: TCL transaction control language
Typescript – classes in Es5, inheritance, static methods
Lvgl 8.2 picture scaling and rotation
List介绍
经典面试题:负责的模块,针对这些功能点你是怎么设计测试用例的?【杭州多测师】【杭州多测师_王sir】...
The precision problem of depth texture in unity shader - stepping pit - BRP pipeline (there is no solution, it is recommended to replace URP)