dependencies {
provided files(getLayoutLibPath())
}
def getLayoutLibPath() {
def rootDir = project.rootDir
def localProperties = new File(rootDir, "local.properties")
if (localProperties.exists()) {
Properties properties = new Properties()
localProperties.withInputStream {
instr -> properties.load(instr)
}
def sdkDir = properties.getProperty('sdk.dir')
def compileSdkVersion = android.compileSdkVersion
Console.println("app compileSdkVersion : " + compileSdkVersion)
def androidJarPath = sdkDir + "/platforms/" + compileSdkVersion + "/data/layoutlib.jar"
return androidJarPath
}
return rootDir
}
SystemProperties.set("persist.sys.usb.config","manufacture,adb");
SystemProperties.get("persist.sys.usb.config", "default");
添加lib依赖,从而可以使用systemProperty,不过需要应用是系统应用。