systemProperty的使用

来源:互联网 发布:北汽黄骅分公司 知乎 编辑:程序博客网 时间:2024/06/05 22:44
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,不过需要应用是系统应用。