[英]Drawable resource files not found for Google Play component
我以前一直在使用Xamarin Studio編寫Google Maps應用程序的代碼,並將文件復制到新文件夾中以在Visual Studio中使用。
在Visual Studio中構建Android應用程序時,我遇到了許多與Google Play組件有關的資源錯誤。
這是錯誤之一:
No resource found that matches the given name (at 'drawable' with value '@drawable/common_signin_btn_icon_pressed_dark')
這是XML文件:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_pressed="true"
android:drawable="@drawable/common_signin_btn_icon_pressed_dark" />
<item
android:state_enabled="false"
android:state_focused="true"
android:drawable="@drawable/common_signin_btn_icon_disabled_focus_dark" />
<item
android:state_focused="true"
android:drawable="@drawable/common_signin_btn_icon_focus_dark" />
<item
android:state_enabled="false"
android:drawable="@drawable/common_signin_btn_icon_disabled_dark" />
<item
android:drawable="@drawable/common_signin_btn_icon_normal_dark" />
</selector>
這些資源文件在代碼中有多重要? 我可以只刪除XML文件中的引用嗎?
提前致謝
我可能遲到了,衷心希望您現在已經知道了這一點,但是對於像我這樣的人,他們已經遇到了這個問題並在google上找到了該帖子,可能會覺得有用。
簡單的答案:卸載軟件包(或組件),並確保不會因文件路徑錯誤而達到最大大小,然后重新安裝。 這應該修復丟失的資源。
使用Xamarin Studio時,我也有類似的經歷。 最初,文件路徑對於Windows(以及可能其他操作系統)而言太長,並且軟件包下載的zip不會解壓縮。 IDE提示我手動下載zip,然后將其解壓縮到適當的位置。 這僅僅是不夠的,因為我遇到了相同的錯誤。 我重命名了幾個文件夾,以允許該軟件包涉及可笑的子目錄命名,並且在重新安裝復制后,我收到了相同的錯誤。
刪除軟件包並重新下載/安裝軟件包后,該項目已構建並且沒有缺少的可繪制資源。
相關來源: 在common_signin_btn_icon_dark.xml http://forums.xamarin.com/discussion/comment/65525/#Comment_65525中 找不到與給定名稱匹配的資源
略有替代先前的答案。 我不想將項目移到較小的路徑,所以我創建了一個原始目錄中的虛擬目錄。 使用DOS cmd
SUB Y:C:\\ Users \\ USER \\ Documents \\ foldername \\ Projects
虛擬目錄y:\\指向源,但使用較短的路徑。 從虛擬目錄打開項目意味着文件名長度等沒有問題。
CR
我在Android Studio中遇到了相同的錯誤,問題是路徑很長,所以我將項目轉移到路徑更小的另一個分區,並且錯誤得到解決
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.