生成 APK/签名捆绑包时,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>
Run Code Online (Sandbox Code Playgroud)
这显然是不正确的,因为我的布局文件如下所示:
<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" …Run Code Online (Sandbox Code Playgroud)