因此,我遇到了这个问题。这是摇篮建立控制台输出:任务'app:process:DebugResources'的执行失败
https://i.stack.imgur.com/YxvfR.png
我查了一些帖子在网上(主要是SO)。到目前为止,我已经更改了buildToolsVersion(它不会让我低于25.0.0),干净构建,重新启动,检查所有XML文件的问题。
没有解决它。我也没有发现任何关于前几个错误的信息(“没有资源匹配......”)。我试图改变这些文件来删除这些行,但1)“他们不是项目的一部分”2)如果我改变了还有另一个错误。
我也回到了我的代码的以前的版本,它的工作,并以某种方式现在他们都显示相同的错误。
您能否指点我正确的方向?我想了解什么是错的,我该如何解决这个问题?
[更新]
下面是res\layout\abc_list_menu_item_layout.xml
代码:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.view.menu.ListMenuItemView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?attr/listPreferredItemHeightSmall">
<!-- Icon will be inserted here. -->
<!-- The title and summary have some gap between them, and this 'group' should be centered vertically. -->
<RelativeLayout
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="?attr/listPreferredItemPaddingLeft"
android:layout_marginRight="?attr/listPreferredItemPaddingRight"
android:duplicateParentState="true">
<TextView
android:id="@+id/scale"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:textAppearance="?attr/textAppearanceListItemSmall"
android:singleLine="true"
android:duplicateParentState="true"
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
<TextView
android:id="@+id/shortcut"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/title"
android:layout_alignParentLeft="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:singleLine="true"
android:duplicateParentState="true" />
</RelativeLayout>
<!-- Checkbox, and/or radio button will be inserted here. -->
而且这一个对res\layout\abc_popup_menu_item_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.view.menu.ListMenuItemView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?attr/dropdownListPreferredItemHeight"
android:minWidth="196dip"
style="@style/RtlOverlay.Widget.AppCompat.PopupMenuItem">
<!-- Icon will be inserted here. -->
<!-- The title and summary have some gap between them, and this 'group' should be centered vertically. -->
<RelativeLayout
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:duplicateParentState="true"
style="@style/RtlOverlay.Widget.AppCompat.PopupMenuItem.InternalGroup">
<TextView
android:id="@+id/scale"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:textAppearance="?attr/textAppearanceLargePopupMenu"
android:singleLine="true"
android:duplicateParentState="true"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
style="@style/RtlOverlay.Widget.AppCompat.PopupMenuItem.Text" />
<TextView
android:id="@+id/shortcut"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/title"
android:textAppearance="?attr/textAppearanceSmallPopupMenu"
android:singleLine="true"
android:duplicateParentState="true"
style="@style/RtlOverlay.Widget.AppCompat.PopupMenuItem.Text" />
</RelativeLayout>
<ImageView
android:id="@+id/submenuarrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:scaleType="center"
android:visibility="gone" />
<!-- Checkbox, and/or radio button will be inserted here. -->
这两个与res\merged\debug\SAME_NAME
的区别是线路xmlns:android="http://schemas.android.com/apk/res/android"
上的错误,表示URI未注册。由于这两个文件都是自动创建的,所以我不知道发生了什么。我搜索了最后一个“未注册的URI”错误,但所提供的所有解决方案都非常不同,似乎对某个项目非常具体,以至于它们似乎并不适用于此。我尝试使用Build Variant“release”,然后将其更改回去,但没有再发生任何事情。
你可以发布文件“res/layout/abc_list_menu_item_layout.xml”。此外,你有多个版本的文件(可能在不同的“res/layout-?”目录中? 看起来布局引用了未定义的视图ID。 – AndroidGuy
@AndroidGuy感谢提示我已经编辑了这个问题来展示代码,并进一步解释了我所遇到的情况,在使用Build Variant“release”之后,除了现在没有重复的东西,我注意到两个文件在build-cache如果我使它无效并重新启动,它应该工作吗?干杯! – ruiBarbs
回答我自己,无效/重新启动缓存不起作用。 – ruiBarbs