Closed fuxuanyang11 closed 1 year ago
问题稍微有点模糊,麻烦根据下面几个步骤确认下: 0、发一下跳转部分的代码 1、检查build文件下生成的对应代码, 根据经验判断有没问题(也可以发出来) 2、查看注入点是否忘记调用ARouter.getInstance().inject(this); 注入 3、更换mUrls模块的注解处理器为原生注解处理器, 然后看是否存在问题 4、将mUrls替换为MutableList, 看是否存在问题
貌似确实会出问题, 代码生成中区分了11中数据类型,8种基础类型Parcelable和Serializable, Object类(走Json解析方案,包括ArrayList等), 因此需要使用withObject传递参数 Arouter使用withObject传参需要自定义序列化工具:
参考:https://github.com/alibaba/ARouter#iv-advanced-usage
// If you need to pass a custom object, Create a new class(Not the custom object class),implement the SerializationService, And use the @Route annotation annotation, E.g:
@Route(path = "/yourservicegroupname/json")
public class JsonServiceImpl implements SerializationService {
@Override
public void init(Context context) {
}
@Override
public <T> T json2Object(String text, Class<T> clazz) {
return JSON.parseObject(text, clazz);
}
@Override
public String object2Json(Object instance) {
return JSON.toJSONString(instance);
}
}
另外, 如果使用json方式完成对象解析, 如果字段内容为空可能会导致崩溃, 我会立即修复这个问题
获取到的数据是空的
请去README更新最新版本(xxx-1.0.2), 按照withObject传递参数即可, 可以去参考app模块的跳转传参示例😘
好的。 谢谢大佬
获取到的数据是空的