Android Studio 中如何引入 layoutlib.jar
修改文件路径:
项目名 / app / build.gradle
在build.gradle配置文件中,
写一个函数,动态获取layoutlib.jar路径,然后加到dependencies中即可,代码如下:
注意:根据build.gradle文件内容修改
dependencies {
provided files(getLayoutLibPath())
}
def getLayoutLibPath() {
return "${android.getSdkDirectory().getAbsolutePath()}" + "/platforms/" + android.compileSdkVersion + "/data/layoutlib.jar"
}
原地址:
http://blog.csdn.net/happyhell/article/details/50435769
http://www.zhihu.com/question/31811664?sort=created
http://stackoverflow.com/questions/16588064/how-do-i-add-a-library-project-to-the-android-studio