组件化项目中使用ARouter来做跳转,集成进来失败
I/ARouter::: ARouter openLog[ ]
I/ARouter::: ARouter openDebug[ ]
I/ARouter::: ARouter printStackTrace[ThreadId=1 & ThreadName=main & FileName=_ARouter.java & ClassName=com.alibaba.android.arouter.launcher._ARouter & MethodName=printStackTrace & LineNumber=145 ]
I/ARouter::: ARouter init start.[ThreadId=1 & ThreadName=main & FileName=ARouter.java & ClassName=com.alibaba.android.arouter.launcher.ARouter & MethodName=init & LineNumber=40 ]
I/ARouter::: Run with debug mode or new install, rebuild router map.[ThreadId=1 & ThreadName=main & FileName=LogisticsCenter.java & ClassName=com.alibaba.android.arouter.core.LogisticsCenter & MethodName=init & LineNumber=69 ]
I/ARouter::: VM with name 'Android' does not have multidex support
E/ARouter::: InstantRun support error, com.android.tools.fd.runtime.Paths
I/ARouter::: Thread production, name is [ARouter task pool No.1, thread No.1][ThreadId=1 & ThreadName=main & FileName=DefaultThreadFactory.java & ClassName=com.alibaba.android.arouter.thread.DefaultThreadFactory & MethodName=newThread & LineNumber=34 ]
D/ARouter::: Filter 3 classes by packageName <com.alibaba.android.arouter.routes>
I/ARouter::: Find router map finished, map size = 3, cost 37 ms.[ThreadId=1 & ThreadName=main & FileName=LogisticsCenter.java & ClassName=com.alibaba.android.arouter.core.LogisticsCenter & MethodName=init & LineNumber=80 ]
I/ARouter::: Load root element finished, cost 2 ms.[ThreadId=1 & ThreadName=main & FileName=LogisticsCenter.java & ClassName=com.alibaba.android.arouter.core.LogisticsCenter & MethodName=init & LineNumber=96 ]
D/ARouter::: LogisticsCenter has already been loaded, GroupIndex[1], InterceptorIndex[0], ProviderIndex[2][ThreadId=1 & ThreadName=main & FileName=LogisticsCenter.java & ClassName=com.alibaba.android.arouter.core.LogisticsCenter & MethodName=init & LineNumber=103 ]
I/ARouter::: ARouter init success![ThreadId=1 & ThreadName=main & FileName=_ARouter.java & ClassName=com.alibaba.android.arouter.launcher._ARouter & MethodName=init & LineNumber=62 ]
W/ARouter::: ARouter::No postcard![ThreadId=1 & ThreadName=main & FileName=_ARouter.java & ClassName=com.alibaba.android.arouter.launcher._ARouter & MethodName=navigation & LineNumber=261 ]
W/ARouter::: ARouter::No postcard![ThreadId=1 & ThreadName=main & FileName=_ARouter.java & ClassName=com.alibaba.android.arouter.launcher._ARouter & MethodName=navigation & LineNumber=261 ]
D/ARouter::: The group [arouter] starts loading, trigger by [/arouter/service/interceptor][ThreadId=1 & ThreadName=main & FileName=LogisticsCenter.java & ClassName=com.alibaba.android.arouter.core.LogisticsCenter & MethodName=completion & LineNumber=145 ]
D/ARouter::: The group [arouter] has already been loaded, trigger by [/arouter/service/interceptor][ThreadId=1 & ThreadName=main & FileName=LogisticsCenter.java & ClassName=com.alibaba.android.arouter.core.LogisticsCenter & MethodName=completion & LineNumber=153 ]
I/ARouter::: Thread production, name is [ARouter task pool No.1, thread No.2][ThreadId=1 & ThreadName=main & FileName=DefaultThreadFactory.java & ClassName=com.alibaba.android.arouter.thread.DefaultThreadFactory & MethodName=newThread & LineNumber=34 ]
I/ARouter::: ARouter init over.[ThreadId=1 & ThreadName=main & FileName=ARouter.java & ClassName=com.alibaba.android.arouter.launcher.ARouter & MethodName=init & LineNumber=47 ]
W/ARouter::: ARouter::No postcard![ThreadId=1 & ThreadName=main & FileName=_ARouter.java & ClassName=com.alibaba.android.arouter.launcher._ARouter & MethodName=navigation & LineNumber=261 ]
W/ARouter::: ARouter::No postcard![ThreadId=1 & ThreadName=main & FileName=_ARouter.java & ClassName=com.alibaba.android.arouter.launcher._ARouter & MethodName=navigation & LineNumber=261 ]
W/ARouter::: ARouter::There is no route match the path [/telephone/mainFragment], in group [telephone][ThreadId=1 & ThreadName=main & FileName=_ARouter.java & ClassName=com.alibaba.android.arouter.launcher._ARouter & MethodName=navigation & LineNumber=278 ]
W/ARouter::: ARouter::No postcard![ThreadId=1 & ThreadName=main & FileName=_ARouter.java & ClassName=com.alibaba.android.arouter.launcher._ARouter & MethodName=navigation & LineNumber=261 ]
W/ARouter::: ARouter::No postcard![ThreadId=1 & ThreadName=main & FileName=_ARouter.java & ClassName=com.alibaba.android.arouter.launcher._ARouter & MethodName=navigation & LineNumber=261 ]
W/ARouter::: ARouter::No postcard![ThreadId=1 & ThreadName=main & FileName=_ARouter.java & ClassName=com.alibaba.android.arouter.launcher._ARouter & MethodName=navigation & LineNumber=261 ]
W/ARouter::: ARouter::There is no route match the path [/inclass/mainFragment], in group [inclass][ThreadId=1 & ThreadName=main & FileName=_ARouter.java & ClassName=com.alibaba.android.arouter.launcher._ARouter & MethodName=navigation & LineNumber=278 ]
W/ARouter::: ARouter::No postcard![ThreadId=1 & ThreadName=main & FileName=_ARouter.java & ClassName=com.alibaba.android.arouter.launcher._ARouter & MethodName=navigation & LineNumber=261 ]
这句log中GroupIndex只有1个,其实就是我们添加的没有加载成功
D/ARouter::: LogisticsCenter has already been loaded, GroupIndex[1], InterceptorIndex[0], ProviderIndex[2][ ]
项目结构是app包含inclass和telephone模块,然后这两个模块包含commonlib模块
在commonlib模块的gradle.build中原来是这样写的
compile 'com.alibaba:arouter-api:1.2.2'
annotationProcessor 'com.alibaba:arouter-compiler:1.1.3'
正确写法,将arouter-compiler
放到使用了@Route
注解的模块中
commonlib的gradle.build
compile 'com.alibaba:arouter-api:1.2.2'
telephone模块的gradle.build
annotationProcessor 'com.alibaba:arouter-compiler:1.1.3'
成功后的log
08-22 14:47:07.526 25615-25615/? I/ARouter::: ARouter openLog[ ]
08-22 14:47:07.526 25615-25615/? I/ARouter::: ARouter openDebug[ ]
08-22 14:47:07.530 25615-25615/? I/ARouter::: ARouter init start.[ ]
08-22 14:47:07.530 25615-25615/? I/ARouter::: Run with debug mode or new install, rebuild router map.[ ]
08-22 14:47:07.534 25615-25615/? I/ARouter::: VM with name 'Android' does not have multidex support
08-22 14:47:07.538 25615-25615/? E/ARouter::: InstantRun support error, com.android.tools.fd.runtime.Paths
08-22 14:47:07.538 25615-25615/? I/ARouter::: Thread production, name is [ARouter task pool No.1, thread No.1][ ]
08-22 14:47:07.562 25615-25615/? D/ARouter::: Filter 9 classes by packageName <com.alibaba.android.arouter.routes>
08-22 14:47:07.562 25615-25615/? I/ARouter::: Find router map finished, map size = 9, cost 33 ms.[ ]
08-22 14:47:07.566 25615-25615/? I/ARouter::: Load root element finished, cost 1 ms.[ ]
08-22 14:47:07.566 25615-25615/? D/ARouter::: LogisticsCenter has already been loaded, GroupIndex[3], InterceptorIndex[0], ProviderIndex[2][ ]
08-22 14:47:07.566 25615-25615/? I/ARouter::: ARouter init success![ ]
08-22 14:47:07.566 25615-25615/? W/ARouter::: ARouter::No postcard![ ]
08-22 14:47:07.566 25615-25615/? W/ARouter::: ARouter::No postcard![ ]
08-22 14:47:07.566 25615-25615/? D/ARouter::: The group [arouter] starts loading, trigger by [/arouter/service/interceptor][ ]
08-22 14:47:07.566 25615-25615/? D/ARouter::: The group [arouter] has already been loaded, trigger by [/arouter/service/interceptor][ ]
08-22 14:47:07.566 25615-25615/? I/ARouter::: Thread production, name is [ARouter task pool No.1, thread No.2][ ]
08-22 14:47:07.566 25615-25615/? I/ARouter::: ARouter init over.[ ]