因此,我遇到了這個問題。這是搖籃建立控制檯輸出:任務'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