简单说,就是要快速集成嘛build.gradle
dependencies {
【省略专用】
//阿里巴巴的路由框架
implementation 'com.alibaba:arouter-api:1.5.1'
annotationProcessor 'com.alibaba:arouter-compiler:1.5.1'
}
defaultConfig {
【省略专用】
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
}
然后,就是初始化
public class RouteApplication extends Application {
//ARouter调用开关
private boolean isDebugARouter=true;
@Override
public void onCreate() {
super.onCreate();
if (isDebugARouter) {
// 打印日志
ARouter.openLog();
// 开启调试模式(如果在InstantRun模式下运行,必须开启调试模式!线上版本需要关闭,否则有安全风险)
ARouter.openDebug();
}
ARouter.init(this);
}
}
记住在清单文件当中调用一下即可
<application
android:name="RouteApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
【省略专用】
到此,基础配置就完成了,然后就是怎么使用了