2017-12-27 190 views
1

我努力讓自己在一個項目的一些改變我的工作,其中之一是從相對ConstraintLayout,事情是不斷變化的一些佈局,當我更換"RelativeLayout""android.support.constraint.ConstraintLayout"甚至當我嘗試使用"android.support.constraint.ConstraintLayout"創建新的XML佈局文件時,android完全不能識別它!不能創建ConstraintLayout

anyhelp? enter image description here

enter image description here

+0

您是否已將Android Studio更新到最新版本? – arkdevelopment

+0

是的,我在一週前更新了它。 –

回答

1

添加這種依賴性在build.gradle文件

implementation 'com.android.support.constraint:constraint-layout:1.0.2' 

,如果您還沒有遷移到搖籃4,使用編譯的,而不是執行。

compile 'com.android.support.constraint:constraint-layout:1.0.2' 
+0

我應該將它添加到依賴項部分嗎? –

+0

是的,只是添加build.gradle的依賴部分 – Munir

+0

是的。內部依賴關係塊。如果你沒有遷移到gradle 4,使用編譯而不是實現 –