android studio应用获取系统属性权限(SystemProperties)

 

dependencies {
    provided files(getLayoutLibPath())
}
 
/** ZhangChao time:2014-12-31,get layoutlib.jar path. android.os.SystemProperties need it. */
// must called after "android" definition
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
}

 

posted on 2018-03-28 09:32  maogefff  阅读(1082)  评论(0编辑  收藏  举报

导航