最近新建項目時,用的studio自動創建Activity,其自動生成根佈局爲android.support.constraint.ConstraintLayout,因爲用着不適應,隨手改成了RelativeLayout,沒想到項目就這樣運行不起來了,報的錯是
In <declare-styleable> ConstraintSet,unable to find attribute android:elevation
Execution faild for task
>com.android.ide.common.process.ProcessException:Failed to execute aapt
BUILD FAILED
鬱悶了半天,原來是自動創建ConstraintLayout佈局時,項目build.greadle裏自動引入了
compile 'com.android.support.constraint:constraint-layout:1.0.2'
意思是建議根佈局使用ConstraintLayout,這裏有兩個辦法:
1、直接將根佈局替換爲ConstraintLayout
2、將compile引入的包直接刪掉