MVVMHabit
MVVMHabit copied to clipboard
【2020】Bug问题,统一在此反馈
如果您在使用中发现存在Bug,请在此提出,一同建造全网最优Android MVVM开发方案,感谢您的反馈!
程序运行后在Bugly上发现一些异常 java.lang.ClassCastException:java.lang.NullPointerException cannot be cast to me.goldze.mvvmhabit.http.ResponseThrowable
查看源码后发现是因为 RetrofitClient.getInstance().create(DemoApiService.class) .demoGet() .compose(RxUtils.bindToLifecycle(getLifecycleProvider())) // 请求与View周期同步 .compose(RxUtils.schedulersTransformer()) // 线程调度 .compose(RxUtils.exceptionTransformer()) // 网络错误的异常转换 .subscribe(new Consumer<BaseResponse<DemoEntity>>() { @Override public void accept(BaseResponse<DemoEntity> response) throws Exception {
}
}, new Consumer<ResponseThrowable>() {
@Override
public void accept(ResponseThrowable throwable) throws Exception {
}
});
并不是所有的异常信息都会经过我们自己写的异常处理,具体原因还在定位。建议修改为 RetrofitClient.getInstance().create(DemoApiService.class) .demoGet() .compose(RxUtils.bindToLifecycle(getLifecycleProvider())) // 请求与View周期同步 .compose(RxUtils.schedulersTransformer()) // 线程调度 .compose(RxUtils.exceptionTransformer()) // 网络错误的异常转换 .subscribe(new Consumer<BaseResponse<DemoEntity>>() { @Override public void accept(BaseResponse<DemoEntity> response) throws Exception {
}
}, new Consumer<Exception>() {
@Override
public void accept(Exception ex) throws Exception {
if( ex instanceof ResponseThrowable) {
//TODO
} else {
//TODO
}
}
});
@751519917 感谢反馈!!
AndroidX那个分支的recycleview 套装是不是需要更新才行? "bindingcollectionadapter" : "me.tatarka.bindingcollectionadapter2:bindingcollectionadapter", "bindingcollectionadapter-recyclerview": "me.tatarka.bindingcollectionadapter2:bindingcollectionadapter-recyclerview",
2.x的版本不支持AndroidX
多个fragment入栈,出栈后,fragment泄露
错误: 无法将类 BindingRecyclerViewAdapters中的方法 setAdapter应用到给定类型; 需要: RecyclerView,ItemBinding<T>,List<T>,BindingRecyclerViewAdapter<T>,ItemIds<? super T>,ViewHolderFactory 找到: RecyclerView,ItemBinding<NetWorkItemViewModel>,ObservableList<NetWorkItemViewModel>,BindingRecyclerViewAdapter<CAP#1>,ItemIds,ViewHolderFactory 原因: 推断类型不符合等式约束条件 推断: CAP#1 等式约束条件: CAP#1,NetWorkItemViewModel 其中, T是类型变量: T扩展已在方法 <T>setAdapter(RecyclerView,ItemBinding<T>,List<T>,BindingRecyclerViewAdapter<T>,ItemIds<? super T>,ViewHolderFactory)中声明的Object 其中, CAP#1是新类型变量: CAP#1从?的捕获扩展Object
你好,导入项目报上面的错误,gradle版本为3.5.3,请问怎么解决?
https://github.com/evant/binding-collection-adapter @bujinhai 可以通过源码改
https://github.com/evant/binding-collection-adapter @bujinhai 可以通过源码改
请问怎么改才能解决这个问题?
多个fragment入栈,出栈后,fragment泄露
你这边应该是ViewPage加fragment造成的,你可以看看这篇文章https://blog.csdn.net/weixin_30682415/article/details/94983262
网络请求服务器不存在的时候会报以下错误: Caused by: java.net.ConnectException: Failed to connect to /192.168.70.140:8888 at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:242) at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:160) at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:257) at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135) at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114) at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at me.goldze.mvvmhabit.http.interceptor.logging.LoggingInterceptor.intercept(LoggingInterceptor.java:78) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at me.goldze.mvvmhabit.http.interceptor.CacheInterceptor.intercept(CacheInterceptor.java:29) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at me.goldze.mvvmhabit.http.interceptor.BaseInterceptor.intercept(BaseInterceptor.java:32) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
add "screenSize" of configChanges in manifest to not recreate fragment cause it not work sometime ( for me is Android 18)
错误:无法将类BindingRecyclerViewAdapters中的方法setAdapter应用到给定类型; 需要:RecyclerView,ItemBinding,List,BindingRecyclerViewAdapter,ItemIds <?超级T>,ViewHolderFactory 找到:RecyclerView,ItemBinding,ObservableList,BindingRecyclerViewAdapter <CAP#1>,ItemIds,ViewHolderFactory 原因:CAP类型不符合等式约束条件 :CAP#1 等式约束条件:CAP#1,NetWorkItemViewModel 其中, T是类型变量: T扩展已在方法setAdapter(RecyclerView,ItemBinding,List,BindingRecyclerViewAdapter,ItemIds <?super T>,ViewHolderFactory)中声明的对象 ,CAP#1是新类型变量: CAP#1从?的捕获扩展对象
你好,引入项目报上面的错误,gradle版本为3.5.3,请问怎么解决?
这个我目前改动是 把布局中 databing{adater} 取消,改到代码中setadapter,这样可以让demo跑起来,我的gradle是 3.5.2,
错误: 无法将类 BindingRecyclerViewAdapters中的方法 setAdapter应用到给定类型; 需要: RecyclerView,ItemBinding,List,BindingRecyclerViewAdapter,ItemIds<? super T>,ViewHolderFactory 找到: RecyclerView,ItemBinding,ObservableList,BindingRecyclerViewAdapter<CAP#1>,ItemIds,ViewHolderFactory 原因: 推断类型不符合等式约束条件 推断: CAP#1 等式约束条件: CAP#1,NetWorkItemViewModel 其中, T是类型变量: T扩展已在方法 setAdapter(RecyclerView,ItemBinding,List,BindingRecyclerViewAdapter,ItemIds<? super T>,ViewHolderFactory)中声明的Object 其中, CAP#1是新类型变量: CAP#1从?的捕获扩展Object
你好,导入项目报上面的错误,gradle版本为3.5.3,请问怎么解决?
这个问题我想是 databinding 泛型的原因导致的,
我这样解决了这个问题
这个是 recyclerview 配置了 binding:adapter="@{adapter}" 产生的错误
比如demo中的 network fragment
先理清adapter的泛型 是哪个对象
这里是com.goldze.mvvmhabit.ui.network.NetWorkItemViewModel
然后在布局添加这句
错误: 无法将类 BindingRecyclerViewAdapters中的方法 setAdapter应用到给定类型; 需要: RecyclerView,ItemBinding,List,BindingRecyclerViewAdapter,ItemIds<? super T>,ViewHolderFactory 找到: RecyclerView,ItemBinding,ObservableList,BindingRecyclerViewAdapter<CAP#1>,ItemIds,ViewHolderFactory 原因: 推断类型不符合等式约束条件 推断: CAP#1 等式约束条件: CAP#1,NetWorkItemViewModel 其中, T是类型变量: T扩展已在方法 setAdapter(RecyclerView,ItemBinding,List,BindingRecyclerViewAdapter,ItemIds<? super T>,ViewHolderFactory)中声明的Object 其中, CAP#1是新类型变量: CAP#1从?的捕获扩展Object 你好,导入项目报上面的错误,gradle版本为3.5.3,请问怎么解决?
这个问题我想是 databinding 泛型的原因导致的, 我这样解决了这个问题 这个是 recyclerview 配置了 binding:adapter="@{adapter}" 产生的错误 比如demo中的 network fragment 先理清adapter的泛型 是哪个对象 这里是com.goldze.mvvmhabit.ui.network.NetWorkItemViewModel 然后在布局添加这句
修改这句 为 新的语句是明确了泛型的(可以查一下databinding 泛型的使用),这样 demo跑起来没问题
我不知道为什么前面的代码消失了。这里添加补充 添加 import com.goldze.mvvmhabit.ui.network.NetWorkItemViewModel 修改为 name=adapter type=MyDatabindingAdapter<NetWorkItemViewModel>
错误: 无法将类 BindingRecyclerViewAdapters中的方法 setAdapter应用到给定类型; 需要: RecyclerView,ItemBinding,List,BindingRecyclerViewAdapter,ItemIds<? super T>,ViewHolderFactory 找到: RecyclerView,ItemBinding,ObservableList,BindingRecyclerViewAdapter<CAP#1>,ItemIds,ViewHolderFactory 原因: 推断类型不符合等式约束条件 推断: CAP#1 等式约束条件: CAP#1,NetWorkItemViewModel 其中, T是类型变量: T扩展已在方法 setAdapter(RecyclerView,ItemBinding,List,BindingRecyclerViewAdapter,ItemIds<? super T>,ViewHolderFactory)中声明的Object 其中, CAP#1是新类型变量: CAP#1从?的捕获扩展Object 你好,导入项目报上面的错误,gradle版本为3.5.3,请问怎么解决?
这个问题我想是 databinding 泛型的原因导致的, 我这样解决了这个问题 这个是 recyclerview 配置了 binding:adapter="@{adapter}" 产生的错误 比如demo中的 network fragment 先理清adapter的泛型 是哪个对象 这里是com.goldze.mvvmhabit.ui.network.NetWorkItemViewModel 然后在布局添加这句 修改这句 为 新的语句是明确了泛型的(可以查一下databinding 泛型的使用),这样 demo跑起来没问题
我不知道为什么前面的代码消失了。这里添加补充 添加 import com.goldze.mvvmhabit.ui.network.NetWorkItemViewModel 修改为 name=adapter type=MyDatabindingAdapter<NetWorkItemViewModel>
如果不需要在Adapter里面执行特殊的操作,那么可以不设置adapter,只要你设置了itembing和items,如果你没有设置adapter,表达式会为你绑定默认的适配器
这样就可以了
这样就可以了
great
多个fragment入栈,出栈后,fragment泄露
你这边应该是ViewPage加fragment造成的,你可以看看这篇文章https://blog.csdn.net/weixin_30682415/article/details/94983262
没用使用ViewPage诶,用的Frafmention的库结合这个,也尝试过直接用原始fragment的 FragmentManager来切换,一样会泄露
更新到最新的3.6.3的As和5.6.4的Gradle,跑不起来了
更新到最新的3.6.3的As和5.6.4的Gradle,跑不起来了
这个问题作者其实已经作过解释了,你找找关键字CAP#1,作者建议gradle不要超过3.5,上面也有回复怎么避免这个问题,我前面的回复太特定了,固定了模板,没有什么参考价值,没有特别的adapter需要 不设置就好,会自动使用默认的
各种内存泄漏...
什么世道,这种东西还有人star??? 谁用谁死的节奏
LoggingInterceptor 报错 在intercept方法中segmentList = ((Request) request.tag()).url().encodedPathSegments(); 其中 request.tag()出现了为null的情况,导致程序不能成长执行
这个用base 继承的方式局限性太大了,建议作者用ActivityLifecycleCallbacks来去掉继承的局限
什么世道,这种东西还有人star??? 谁用谁死的节奏
这框架怎么了。。。刚准备用。。
什么世道,这种东西还有人star??? 谁用谁死的节奏
这框架怎么了。。。刚准备用。。
这框架会限制太多,灵活度不高,可以借鉴,切忌不要拿来即用,自己多想想自己的项目现在什么阶段,结合实际情况自己定制。
什么世道,这种东西还有人star??? 谁用谁死的节奏
这框架怎么了。。。刚准备用。。
这框架会限制太多,灵活度不高,可以借鉴,切忌不要拿来即用,自己多想想自己的项目现在什么阶段,结合实际情况自己定制。
项目刚准备开发,属于要快速上架的产品。。。想用这个框架快速开发的,省的自己去搭建框架。。应该没啥大问题吧。。我看你说的以为有多严重的设计缺陷呢。。
什么世道,这种东西还有人star??? 谁用谁死的节奏
这框架怎么了。。。刚准备用。。
这框架会限制太多,灵活度不高,可以借鉴,切忌不要拿来即用,自己多想想自己的项目现在什么阶段,结合实际情况自己定制。
老哥 我看了你头像。。你和我哥长的一模一样😂😂😂
执行完requestBuilder.build(),url发生了重定向
需要离线鉴黄的可以看我首页,demo使用mvvm
错误: 不兼容的类型: Context无法转换为Application