ARouter::There is no route match the path

ARouter:https://github.com/alibaba/ARouter
在使用服务时会提示找不到路由路径,但是已经按照官网提示的配置好了路径。
原因:可能是配置出现问题。
在模块化开发时需要在各个模块的build.gradle里都要配置

defaultConfig {
        ...

        javaCompileOptions {
            annotationProcessorOptions {
                arguments = [moduleName: project.getName()]
            }
        }

    }


dependencies {
    ...

    annotationProcessor 'com.alibaba:arouter-compiler:1.1.4'
    implementation project(':base')//base模块里添加依赖

}

同时base模块里

dependencies {
   ...
    compile ('com.alibaba:arouter-api:1.3.1'){ exclude group: 'com.android.support' }
//    implementation 'com.alibaba:arouter-api:1.3.1'

}

注意:导入arouter-api时可能出现V4包版本不一致,如下异常,所以将其屏蔽

Error:Execution failed for task ':app:preDebugBuild'.
> Android dependency 'com.android.support:support-v4' has different version for the compile (25.2.0) and runtime (27.1.1) classpath. You should manually set the same version via DependencyResolution

虽然编译没有问题,但是在运行时可能出现异常

 com.android.build.api.transform.TransformException: com.android.dex.DexException: Multiple dex files define Lcom/alibaba/android/arouter/routes/ARouter$$Group$$user;

解决方法:https://www.jianshu.com/p/c47db5f33d5f

你可能感兴趣的:(ARouter::There is no route match the path)