2016-06-12 105 views
9

我在Azure上部署了一臺虛擬機。我已經安裝了Visual Studio 2015,Xamarin和其他移動開發工具。 我在本地計算機上做了相同的設置,以在Visual Studio的設備上測試我的應用程序Xamarin:找不到與指定名稱匹配的資源(AppCompat)

唯一的區別是安裝Android SDK。在我的本地機器上,我沒有圖像系統。

Android DSK Manager

我開發我的虛擬機上的應用程序。編譯期間我沒有錯誤。 我使用Android.Support.Design,Android.Support.V4,Android.Support.V7.AppCompat,Android.Support.V7.RecyclerView(NuGet的最新版本)及其MvvmCross實現。

My Azure Virtual Machine

我想繼續我的本地計算機上的應用程序的開發。 NuGet軟件包已正確恢復。

當我建立的應用程序,我有一些錯誤:

My Local Machine

Error  Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'. Novatech.Droid D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml 
Error  Error retrieving parent for item: No resource found that matches the given name 'Base.Widget.AppCompat.Button'. Novatech.Droid D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml 
Error  No resource found that matches the given name: attr 'buttonStyle'. Novatech.Droid D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml 
Error  No resource found that matches the given name: attr 'colorAccent'. Novatech.Droid D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml 
Error  No resource found that matches the given name: attr 'colorPrimary'. Novatech.Droid D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml 
Error  No resource found that matches the given name: attr 'colorPrimaryDark'. Novatech.Droid D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml 
Error  No resource found that matches the given name: attr 'windowActionBar'. Novatech.Droid D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml 
Error  No resource found that matches the given name: attr 'windowNoTitle'. Novatech.Droid D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml 
Error  No resource found that matches the given name: attr 'windowNoTitle'. Novatech.Droid D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml 

我試圖

  • 通過改變'Theme.AppCompat.Light.DarkActionBar「@ android:styles/Theme.AppCompat.Light.DarkActionBar'和其他一些(android/styles)
  • 改變target=android-19target=android-21C:\Program Files (x86)\Android\android-sdk\extras\android\support\v7\appcompat\project.properties

有人能向我解釋什麼問題?我掉了。相同的操作系統,相同的工具,相同的SDK,相同的JDK,

+0

請清理和重建項目, –

回答

0

我從Xamarin組件切換到NuGet包,它現在可以工作。 MvvmCross爲其依賴關係(MvvmCross.Droid.Support.V4,MvvmCross.Droid.Support.V7.AppCompat,MvvmCross.Droid.Support.V7.Preference ...)安裝了最新版本的軟件包Nuget(23.3.0)。和更早使用的組件。

我還必須從我的虛擬機複製「C:\ Users \ andres \ AppData \ Local \ Xamarin」文件夾。

在Visual Studio中,我沒有通知組件可用的更新。

1

試試這個。

導航至C:\Program Files (x86)\Android\android-sdk\extras\android\support\v7\appcompat

打開project.properties文件。

將目標android更改爲target=android-21

+0

已經嘗試過(從目標=機器人-19) –

12

我在Mac上遇到了與Xamarin Studio相同的問題。我所做的解決這個問題的方法是更新NuGet軟件包Xamarin.Android.Support.v7.AppCompat。我想你也可以使用相同的方法來解決你在Visual Studio上的問題。

看看
enter image description here

+0

我有最新版本(23.3.0) –

+1

我不得不刪除整個支持庫並重新添加它們 –

+1

不幸的是,它沒有工作,因爲它給了我這個消息: 正在更新'Xamarin.Android.Support.v7.AppCompat 23.3。 0'到'Xamarin.Android.Support.v7.AppCompat 23.4.0.1'失敗。無法找到與'Xamarin.Android.Support.v7.AppCompat 23.4.0.1'兼容的'Xamarin.Forms'版本。 雖然Xamarin。Forms包更新到最新的 –

1

這些步驟:

的 「Xamarin.Android.Support.v7.AppCompat」 創建新的應用程序 enter image description here

然後點擊右鍵,選擇「更新」。

等待IDE完成更新並重建應用程序。 enter image description here

0

在我的情況,我能夠在XML -> Schemas菜單添加android-layout-xml.xsdschemas.android.com.apk.res.android.xsd來解決這個問題(僅當在axml文件訪問)。 對於這些文件的確切位置,我建議在計算機上進行搜索,因爲它們不在Xamarin文件夾中,正如其他答案中所建議的那樣。在我的情況下,他們在obj文件夾下的項目[obj -> Debug -> Schemas ...]

希望這會幫助你解決你的問題。

0

在我的情況下,問題是我有一個本地的Nuget包服務器。

花了我一段時間才意識到Xamarin Studio試圖從錯誤的來源更新軟件包。

5

在我的情況,「最小的Android版本」 API 21,但「目標的Android版」是「利用目標框架版本(API 23)」,但它前面沒有工作,那麼我就將這兩個版本都指向API 21,並且突然開始按預期工作。

後來我改變最小的Android版本是API 21和Target的Android版本爲 「使用目標框架版本(API 23)」

0

嘗試以下一項或所有這些:

  1. 解決方案包廣恢復
  2. 重新啓動Visual Studio
  3. 清潔&重建

它解決了我的問題

+0

它沒有,我甚至不得不重新啓動我的筆記本電腦。 – david

0

在我的情況下,匹配Xamarin.Support版本到Target Framework版本工作。

例如: 如果你的目標25 API那麼你的支持庫也應該是25.x ..

相關問題