Android運行時報錯:In ConstraintSet

最近新建項目時,用的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引入的包直接刪掉

發佈了41 篇原創文章 · 獲贊 42 · 訪問量 10萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章