Reputation: 7459
I'm trying to rebuild an Android application on VS and Xamarin but I get this error
No resource found that matches the given name: attr 'android:elevation'.
this is the attribute:
<item name="android:elevation">@dimen/design_bottom_sheet_modal_elevation</item>
I use these values for compiling:
the error comes from the file values.xml, but sometimes the same error happens with different attributes in files; values-23.xml or 22..etc
Upvotes: 2
Views: 19995
Reputation: 1867
Set property as AndroidResource in BuildAction for all style.xml and image files. Keep in mind all the files must be in Resources folder within .Droid project.
Upvotes: 0
Reputation: 222
Elevation is only for Android 5.x+ so you must change compilation to use 5.0 or above.
your /Resources/values/style.xml should look more or less like:
<?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>
Also check your style.xml in your /Resources/values folder and make sure you set styles for API level v21+ look like: /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>
Upvotes: 3
Reputation: 391
Change the compilation version to Android 5.0 or above. elevation attribute was introduced in 5.0. So Kit-kat build tools will fail.
Upvotes: 11