java - 无法生成签名的APK?

标签 java android xml android-layout

我正在尝试生成签名的 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/

相关文章:

java - 从静态方法访问非静态成员变量

java - 两个具有相同编号的构造函数。参数但不同的数据类型

android - 将字符串保存到内部存储器然后显示它

android - 无法在Firebase数据库的userid文件夹内创建新路径

java - 如何从 Android GridView onItemClick 添加新 Activity ?

java - JAXB/MOXy : How to un-/marshall a field containing a scalar or list of scalars

java - 存储每次 session 都需要但永远不会改变的数据的最佳方式

java - Android Studio错误: java version not found

Java XML vs SQL vs 自定义数据存储

java - 我的 NavigationDrawer 中的 TextView 文本垂直剪切