我正在尝试生成签名的 APK。但由于生成时的 lint 错误而无法生成它。我检查了我的 lint 报告,它在我的 XML 文件中显示错误。
“NotSibling”类型问题的说明: 给定ConstraintLayout或RelativeLayout中的布局约束应该 引用同一相对布局中的其他 View (但不是其本身!)
1 errors, 0 warnings
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:lintVitalRelease'.
Lint found fatal errors while assembling a release target. To proceed, either fix the issues identified by lint, or modify your build script as follows: ... android { lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, // but continue the build even when errors are found: abortOnError false
这是我的 XML:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:background="@color/background">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/all_featured_deals_divider"
android:orientation="vertical"
android:overScrollMode="never">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="3dp"
android:paddingRight="6dp"
android:paddingLeft="6dp"
android:paddingBottom="3dp">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/notificationsRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="false"/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</RelativeLayout>
此行出现错误:
android:layout_below="@+id/all_featured_deals_divider"
../../src/main/res/layout/notification_view.xml:48: @+id/all_featured_deals_divider is not a sibling in the same RelativeLayout
错误是:给定ConstraintLayout或RelativeLayout中的布局约束应该引用同一相对布局中的其他 View (但不是它本身!)
最佳答案
删除android:layout_below="@+id/all_featured_deals_divider"
如果您要重用 xml,例如使用 include,在那里进行约束。
关于java - 无法生成签名的APK?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60744085/