问题
I have previously been using Xamarin Studio to code a Google Maps application and have copied the files into a new folder to use in Visual Studio.
I am getting many resource errors all in relation to the Google Play component when building the Android application in Visual Studio.
Here is one of the errors:
No resource found that matches the given name (at 'drawable' with value '@drawable/common_signin_btn_icon_pressed_dark')
Here is the XML file:
<?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>
How important are these resource files in the code? Can I just remove the references in the XML file?
Thanks in advance
回答1:
I may be late to this and sincerely hope you have this figured out by now, but for people like myself who have experience this issue and found the post on google may find it useful.
The simple answer: Uninstall the package (or component) and re-install after ensuring you won't hit the maximum size for a file path error. This should fix the missing resources.
I had a similar experience using Xamarin Studio. Originally the file paths were far too long for Windows (and presumably other operating systems) and the zip that is downloaded by the package would not un-zip. The IDE prompted me to manually download the zip, and un-zip it to the appropriate location. This was simply not enough, as I encountered the same errors. I renamed a couple of folders to allow for the ridiculous sub-directory naming involved with the package, and after re-installation copying I received the same error.
After removing the package and re-downloading/installing the package, the project built and did not have the missing drawable resources.
Related Sources: No resource found that matches the given name in common_signin_btn_icon_dark.xml http://forums.xamarin.com/discussion/comment/65525/#Comment_65525
回答2:
A slight alternative to the previous answer. I didn't want to move my project to a smaller path so I created a virtual directory sourced from the original path. Using the DOS cmd
SUBST y: C:\Users\USER\Documents\foldername\Projects
The virtual directory y:\ points at the source but uses a shorter path. Opening the project from the virtual directory meant there were no problems with filename lengths etc.
CR
回答3:
I got the same error in Android Studio, the problem was long path, so i shifted the project to another partition with a smaller path and the error solved
来源:https://stackoverflow.com/questions/23979768/drawable-resource-files-not-found-for-google-play-component