1

I'm working in a project and I would like to use Constraint! If I use it, when i want build the gradle or intall the apk in a pohne, i've this error:

"Error:In ConstraintSet, unable to find attribute android:elevation"

This is my gradle configuration:

  defaultConfig {
    applicationId "application"
    minSdkVersion 14
    targetSdkVersion 17
    versionCode 25
    versionName "3.11"

}

Can i change sometigh? There is a way to use constraint without change the version? Thanks

Paul
  • 511
  • 1
  • 5
  • 7

2 Answers2

2

You can try to compile with compile'com.android.support.constraint:constraint-layout:1.0.1 in build.grade. Or check compileSdkVersion to newest version

Nam Joker
  • 31
  • 3
  • In my gradle i've this: compile 'com.android.support.constraint:constraint-layout:1.0.0' Also in AndroidSDK tools i've update the newwst version, But I've already this errore when i build my app – Paul May 15 '17 at 10:35
  • 1
    You can check here: [Document](https://developer.android.com/training/constraint-layout/index.html#constraints-overview). Constraint layout require Android studio 2.3 or higher and the newest version of Constraint layout is 1.0.1. you can try it – Nam Joker May 15 '17 at 10:51
1

The android:elevation attribute is pretty new. It defines the lift of the view on which its applied. It's used in Material Design in the newest Android Versions.

You can use it on API Level 21, and here you targeted Level is 17 which is lower than this. replace your targeted version to 21 or above

If you want to get some shadowing effect you can use this:

Shadow

Hope this helps.

Community
  • 1
  • 1
Dhiren Basra
  • 820
  • 9
  • 24
  • Yes, the problem is this! If i change my version from 17 to 21 it work. But i cannot change my version because i have not the permission to do that. There is another way to use constraint layout with version 17? Thanks – Paul May 15 '17 at 13:17
  • _But i cannot change my version because i have not the permission to do that_ can you plz elaborate this, why you don't have permission ? – Dhiren Basra May 15 '17 at 13:30
  • Because it's a project and I haven't the permission from my team. Nobody want to change the current version – Paul May 15 '17 at 13:38
  • Your question is about shadowing right ? and not about constraint layout !! you get error in ConstraintSet. ConstraintSet provide attribute android:elevation and There is no another way to use constraint layout with version 17 ! but you still need shadowing then you may check my above answer Link with Shadow tag. and simply remove android:elevation attribute. [ConstraintSet Document](https://developer.android.com/reference/android/support/constraint/ConstraintSet.html) refer this document. – Dhiren Basra May 15 '17 at 13:47