在android studio中引入layoutlib.jar
def getLayoutLibPath() {
return “${android.getSdkDirectory().getAbsolutePath()}” + “/platforms/” + android.compileSdkVersion + “/data/layoutlib.jar”
}
android {
….
}
dependencies {
compile fileTree(dir: ‘libs’, include: ‘*.jar’)
provided files(getLayoutLibPath())
}