生成APK/Signed Bundle时,lintVitalRelease返回此报告:
<issue
id="InvalidSetHasFixedSize"
severity="Fatal"
message="When using `setHasFixedSize() in an `RecyclerView`, `wrap_content` cannot be used as 
a value for `size` in the scrolling direction."
category="Correctness"
priority="5"
summary="When using `setHasFixedSize() in an `RecyclerView`, `wrap_content` cannot be used as 
a value for `size` in the scrolling direction."
explanation="When a RecyclerView uses `setHasFixedSize(...)` you cannot use `wrap_content` for size in the scrolling direction."
errorLine1=" recyclerView.setHasFixedSize(true);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="/home/Documents/MyProject/app/src/main/java/com/myproject/MainActivity.java"
line="97"
column="9"/>
</issue>
这显然不是真的,因为我的布局文件看起来像这样:
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/parent_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/refresh_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:clipToPadding="false"
android:overScrollMode="never"
android:paddingTop="8dp"
android:scrollbars="none"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
皮棉有问题还是我把东西弄砸了?
在我将kotlin与我的java项目集成后,这就成了一个问题!
代码中的错误可能是这个
<android.support.v7.widget.RecyclerView
android:id="@+id/my_recycler_view"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
在这种情况下,我们将使用my_recycler_view.setHasFixedSize(true(
<android.support.v7.widget.RecyclerView
android:id="@+id/my_recycler_view"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
在我的另一个回收窗口.setHasFixedSize(false(中,如果我们也使用wrap_content作为宽度,这也适用