-
Notifications
You must be signed in to change notification settings - Fork 209
xiaojinzi123 edited this page Nov 4, 2019
·
13 revisions
欢迎您来访问组件化文档
Wiki
,在这里你将看到对组件化的一个全面的介绍.如果看完还有不懂的,请issue
我.
这里会给出一个最简单的过程完成整个组件化搭建
AndroidX
请查看 依赖和配置-AndroidX
非 AndroidX
请查看 依赖和配置
进阶配置请查看 RouterAnno注解
@RouterAnno(
host = "app", // host 是可选的,如果不写默认采用 build.gradle 中配置的 host
path = "info"
)
public class InfoAct extends AppCompatActivity {
// ......
}
Router.with().hostAndPath("app/info").navigate();
如果你会销毁当前界面在启动了另一个界面之后, 你需要特别注意以下的用法
正确的原生用法
Intent intent = new Intent(this, XXXActivity.class);
startActivity(intent);
finish();
错误的路由用法
Router.with()
.hostAndpath("user/userCenter")
.forward();
finish();
正确的路由用法
Router.with()
.hostAndpath("user/userCenter")
.afterxxxAction(() -> {
finish();
})
.forward();
- 原因1:你没有按照文档上的说的配置注解驱动器
- 原因2:你没有按照文档上的说的 App中加载对应的模块
- 原因3:你在 App中加载的模块名称 和你在模块的 build.gradle中的配置 不一样
- 原因4:你发起跳转的
host
和path
匹配不上目标的host
和path
- 原因5:你可以在
Logcat
中看Debug
级别的日志,查看跳转失败的原因 - 原因6:混淆配置是否配置了