【发布时间】:2020-06-29 19:34:01
【问题描述】:
我正在尝试生成签名的 APK。但由于生成时的 lint 错误而无法生成它。我检查了我的 lint 报告,它在我的 XML 文件中显示错误。
“NotSibling”类型问题的解释: 给定 ConstraintLayout 或 RelativeLayout 中的布局约束应该 引用同一相对布局中的其他视图(但不引用自身!)
1 个错误,0 个警告
FAILURE:构建失败并出现异常。
出了什么问题:任务 ':app:lintVitalRelease' 执行失败。
Lint 在组装发布目标时发现致命错误。 要继续,请修复 lint 确定的问题,或按如下方式修改构建脚本: ... android { lintOptions { checkReleaseBuilds 错误 // 或者,如果您愿意,您可以继续检查发布版本中的错误, // 但即使发现错误也要继续构建: abortOnError 错误
这是我的 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 不是同级的兄弟 相对布局
错误是:给定 ConstraintLayout 或 RelativeLayout 中的布局约束应该引用同一相对布局中的其他视图(但不是自身!)
【问题讨论】:
-
去掉那一行 android:layout_below
标签: java android xml android-layout