Reputation: 1363
As per guidelines here for Android L development, I used android:elevation
property in my application, but it shows the following error:
No resource identifier found for attribute elevation in package android
I am using eclipse and I have downloaded the latest version just 2 days ago.
I have also set my target sdk as API level 21
and minimum as API level 14
. I have also installed the latest updates on sdk-build tools shown in sdk manager.
Anyone know the solution? plz help me.
Upvotes: 4
Views: 6037
Reputation: 14021
android:elevation
or View.setElevation()
is introduced since Android API 21. So, if you set android:minSdkVersion="14"
, it's not OK. android:minSdkVersion="14"
is integrant.
Upvotes: 0
Reputation: 5097
1) Select Project > Right Click > Properties > Check Android L > apply > Ok
2) android:minSdkVersion="L"
Hope this will work for you.
Upvotes: 1
Reputation: 3033
Select Project, then Properties, then Android and tick Android 5.0. Ignore all the answers telling you to set android:minSdkVersion
. Android is designed to ignore stuff inside elements it does not understand just so that in this case you can apply elevation when running on lollipop devices and it is ignored on earlier devices.
You can hide the remaining lint warning in the xml file by adding tools:ignore="NewApi"
in the element. This needs xmlns:tools="http://schemas.android.com/tools"
specified in the root element.
AppCompat v21 allows a fair bit of Material Design to be used on pre-lollipop devices, but I've yet to work out how to add it to a project in Eclipse.
Upvotes: 0
Reputation: 3177
One thing worth noting is that Android Lollipop corresponds to API level 21
. There is no such thing (yet) as API level 22
.
You should be able to solve your problem by setting android:minSdkVersion
and android:targetSdkVersion
to "21"
.
Upvotes: 0