liangjingkanji / BRV

[使用文档] Android 快速构建 RecyclerView, 比 BRVAH 更简单强大
http://liangjingkanji.github.io/BRV/
MIT License
2.51k stars 317 forks source link

使用PageRefreshLayout会编译不通过,报找不到NestedScrollingParent的类文件 #57

Closed dlisagod closed 2 years ago

dlisagod commented 2 years ago

` <com.drake.brv.PageRefreshLayout android:id="@+id/page" android:layout_width="match_parent" android:layout_height="0dp" android:layout_marginTop="6dp" android:layout_marginBottom="6dp" android:paddingLeft="4dp" android:paddingRight="4dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintTop_toBottomOf="@id/ll_list_title" app:stateEnabled="true">

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/rv_user"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" />

            </com.drake.brv.PageRefreshLayout>`

错误: cannot generate view binders com.sun.tools.javac.code.Symbol$CompletionFailure: 找不到android.support.v4.view.NestedScrollingParent的类文件

试过1.3.33和1.3.35都是

liangjingkanji commented 2 years ago

Demo可以运行吗? 你可能是没有添加recyclerview依赖

implementation "androidx.recyclerview:recyclerview:1.1.0"
dlisagod commented 2 years ago

Demo可以运行吗? 你可能是没有添加recyclerview依赖

implementation "androidx.recyclerview:recyclerview:1.1.0"

有的,去掉这个PageRefreshLayout包裹就是正常运行的了,包裹PageRefreshLayout在预览页是灰色的,直接用那个SmartRefreshLayout包裹也是一样情况,估计是我这项目缺少supportv4?用的Androidx跟material的了,UI相关的库版本如下 appcompat : 'androidx.appcompat:appcompat:1.2.0', material : 'com.google.android.material:material:1.2.1', recyclerview : 'androidx.recyclerview:recyclerview:1.1.0', viewpager : 'androidx.viewpager2:viewpager2:1.0.0', constraintlayout : 'androidx.constraintlayout:constraintlayout:2.1.0',

dlisagod commented 2 years ago

我跑一下你的Demo看看

liangjingkanji commented 2 years ago

项目中是否存在jcenter库

dlisagod commented 2 years ago

项目中是否存在jcenter库

跟jcenter应该是没关系的。 我先改回去重新编译了几次不行。点击PageRefreshLayout的源码再点击SmartRefreshLayout还是看到其继承的NestedScrollingParent报红的,上面还有其它supportv4相关的全红。

dlisagod commented 2 years ago

你Demo的没问题,我再找找各种可能看看

dlisagod commented 2 years ago

你Demo的没问题,我再找找各种可能看看

Demo里SmartRefreshLayout的源码还是看到其继承的NestedScrollingParent报红的,上面还有其它supportv4相关的全红,但是能编译运行,我的项目里不行,让人费解

dlisagod commented 2 years ago

现在可以了,奇奇怪怪,可能是AS抽风了。 我经过一下测试: 1、一开始想到 添加 api 'androidx.legacy:legacy-support-v4:1.0.0',不行 2、 换成 api 'com.android.support:support-v4:28.0.0',不行 3、在2的基础上使用AS的Refactor->Migrate to Androidx(可本来就是 Androidx项目),然后其实就是把2变为1,居然能编译通过了。 4、在3的基础上,去掉依赖库(其实不就是恢复到最开始啥都没改?),也还是能编译通过 5、ctrl z 一直撤销,提示Undo migrate to Androidx ,确定,之后确实又不行了,然后再尝试Migrate to Androidx提示No xxx migrate to Androidx ,郁闷。 6、重复1 2 3 的情况

总结,这种情况,先api 'com.android.support:support-v4:28.0.0',再Refactor->Migrate to Androidx,就可用编译运行了,即使去掉依赖库也行。反正就是让人摸不着头脑

liangjingkanji commented 2 years ago

或者试下重启并清除缓存

dlisagod commented 2 years ago

或者试下重启并清除缓存

这个一开始就试过的,没用的,不过现在解决了