2016-05-25 68 views
2

我试图重建的VS和Xamarin 一个Android应用程序,但我得到这个错误没有资源发现在给定名称匹配:ATTR“机器人:海拔”

No resource found that matches the given name: attr 'android:elevation'.

这是属性:

<item name="android:elevation">@dimen/design_bottom_sheet_modal_elevation</item> 

我使用这些值来编译:

enter image description here

错误来自文件values.xml,但有时会发生文件中不同属性的相同错误;值-23.xml或22 ..等等

回答

11

将编译版本更改为Android 5.0或更高版本。在5.0中引入了海拔属性 。 So Kit-kat构建工具将失败。

+0

我改变了编译版本为你描述:我摆脱错误的,但我得到另一个错误:java.lang.OutOfMemoryError。考虑增加$(JavaMaximumHeapSize)的值。 Java运行时内存不足,执行'java.exe –

+1

@MohamedAhmed转到您的Android选项 - >高级选项卡 - >高级Android构建设置并将Java堆大小设置为1G,例如 – Ingenator

+0

@Amit Kumar,我一直想知道...为什么他们甚至让人们在那里设置KitKat 4.4?是否有配置可以工作的场景? – Marshall

2

海拔仅适用于Android 5.x +,因此您必须更改编译为使用5.0或更高版本。

您/Resources/values/style.xml应该或多或少是:

<?xml version="1.0" encoding="utf-8" ?> 
<resources> 
    <style name="MyTheme" parent="MyTheme.Base"> 
    </style> 
    <style name="MyTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar"> 
    <!--If you are using revision 22.1 please use just windowNoTitle. Without android:--> 
    <item name="windowNoTitle">true</item> 
    <!--We will be using the toolbar so no need to show ActionBar--> 
    <item name="windowActionBar">false</item> 
    <!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette--> 
    <!-- colorPrimary is used for the default action bar background --> 
    <item name="colorPrimary">#00FFAA</item> 
    <!-- colorPrimaryDark is used for the status bar --> 
    <item name="colorPrimaryDark">#004D40</item> 
    <!-- colorAccent is used as the default value for colorControlActivated 
     which is used to tint widgets --> 
    <item name="colorAccent">@color/accent</item> 
    <!-- You can also set colorControlNormal, colorControlActivated 
     colorControlHighlight and colorSwitchThumbNormal. 
    <item name="colorControlNormal">#00897B</item> 
    <item name="colorControlActivated">#1DE9B6</item>--> 
    <item name="windowActionModeOverlay">true</item> 
    </style> 
</resources> 

还要检查你的style.xml在你的/资源/文件夹值,并确保您为API级别V21 +风格是这样的:在BuildAction的/Resources/values-v21/style.xml

<?xml version="1.0" encoding="utf-8" ?> 
<resources> 
    <!-- 
     Base application theme for API 21+. This theme replaces 
     MyTheme from resources/values/styles.xml on API 21+ devices. 
    --> 
    <style name="MyTheme" parent="MyTheme.Base"> 
    <item name="android:windowContentTransitions">true</item> 
    <item name="android:windowAllowEnterTransitionOverlap">true</item> 
    <item name="android:windowAllowReturnTransitionOverlap">true</item> 
    <item name="android:windowSharedElementEnterTransition">@android:transition/move</item> 
    <item name="android:windowSharedElementExitTransition">@android:transition/move</item> 
    </style> 
</resources> 
0

设置属性为AndroidResource所有style.xml和图像文件。请记住,所有文件必须位于.Droid项目中的Resources文件夹中。

0

您需要添加最新的支持库以在Kitkat中添加CardView和RecyclerView。

高程仅适用于Android 5.x的+

添加下列项目中的gradle这个依赖

compile 'com.android.support:cardview-v7:23.4.0' 
compile 'com.android.support:recyclerview-v7:23.4.0' 
相关问题