美文网首页
ARouter::There is no route match

ARouter::There is no route match

作者: 扎心的_老铁 | 来源:发表于2019-11-15 16:29 被阅读0次

我们再集成Arouter的时候有时候会遇到这个错误,查了好久都找不到答案,该配置的都配置了,还是不行,最后终于解决了,在这里总结一下。

1、集成Arouter

在module的build.gradle中添加(defaultConfig中)

javaCompileOptions {

annotationProcessorOptions {

arguments = [AROUTER_MODULE_NAME:project.getName()]

}

}

添加依赖:

dependencies{//Replace with the latest version

implementation'com.alibaba:arouter-api:?'

annotationProcessor'com.alibaba:arouter-compiler:?'

...}

初始化Arouter

if(isDebug()) {//These two lines must be written before init, otherwise these configurations will be invalid in the init process

ARouter.openLog();//Print log

ARouter.openDebug();//Turn on debugging mode (If you are running in InstantRun mode, you must turn on debug mode! Online version needs to be closed, otherwise there is a security risk)

}

ARouter.init(mApplication);

重点来了

上边都配置好了但是还是不能跳转,最后发现可能是因为我的项目中有kotlin支持,所以修改如下

apply plugin:'kotlin-kapt'

我也不知道怎么回事,改成这样就ok了,哈哈哈

相关文章

网友评论

      本文标题:ARouter::There is no route match

      本文链接:https://www.haomeiwen.com/subject/bhesictx.html