这个SystemProperties类主要是在这个jar包中layoutlib.jar,所以现在的办法就是让这个 jar包加载到 android studio中

下面讲解如何添加:

1、找到对应项目的 build.gradle文件中,在 dependencies 中添加依赖,添加如下:

compileOnly files("D://Android/Sdk/platforms/android-19/data/layoutlib.jar")

注:如果按照网上说的使用provided时会提示这个方法已经过期,用compileOnly代替,由于我的项目是在android4.4上面,对应的API为19,所以就引用了android-19下面的layoutlib.jar文件。
上面文件路径我用的是绝对路径,为使项目在其它电脑上也可以正常使用,建议不要这么使用绝对路径,可以通过获取系统的环境变量,从而知道android sdk在哪个路径下,然后把layout.lib文件组合起来。 操作方法如下,直接贴上 build.gradle中的代码
 apply plugin: 'com.android.application'

 android {
compileSdkVersion 28
defaultConfig {
applicationId "com.test.test"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" //以下是为了找到android.os.SystemProperties这个隐藏的类
String SDK_DIR = System.getenv("ANDROID_HOME")
//("TAG", "SDK_DIR = " + SDK_DIR );
if(SDK_DIR == null) {
Properties props = new Properties()
props.load(new FileInputStream(project.rootProject.file("local.properties")))
SDK_DIR = props.get('sdk.dir'); }
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
} dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
compileOnly 'com.google.android.wearable:wearable:2.4.0'
implementation 'com.google.android.support:wearable:2.4.0'
implementation 'com.google.android.gms:play-services-wearable:16.0.1'
implementation 'com.android.support:percent:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
compileOnly files("${SDK_DIR}/platforms/android-19/data/layoutlib.jar") }

2、然后在android studio中新建一个class文件,再输入到 import android.os.S...  的时候就会关联出SystemProperties,说明该 jar包引入成功

Android Studio中无法找到android.os.SystemProperties解决办法的更多相关文章

  1. Android studio中怎么导入android.support.v4包

    Android studio中怎么导入android.support.v4包 1.File点击选择projectStructure选择对应的APP然后点击Dependencies 2.点击+号,点击第 ...

  2. Android Studio 找不到夜神模拟器的解决办法

    Android Studio 找不到夜神模拟器的解决办法 1.启动夜神模拟器 2.找到你电脑上的夜神安装目录,在bin目录下打开cmd窗口,运行命令 nox_adb.exe connect 127.0 ...

  3. Android Studio出现Wait for build to finish解决办法

    公司用钉钉打卡,我作弊哈哈,买了个大牛助手. 刚续费包年,开发商竟然跑路了.服务器连不上,不能用了,心血来潮想说能否自己破解了.好家伙需要学的还真不少,首先还要从安卓开发学起... 刚装了Androi ...

  4. Android Studio 创建虚拟机失败 Failed to load 解决办法

    Name: Nexus_S_API_21 CPU/ABI: ARM (armeabi) Path: H:\Users\Pavkoo\.android\avd\Nexus_S_API_21.avd Er ...

  5. Android Studio 创建项目后“Cannot resolve symbol” 解决办法

    报错位置显示 “Cannot resolve symbol XXX”, 解决方法如下: 点击菜单中的 “File” -> “Invalidate Caches / Restart”,然后点击对话 ...

  6. Android Studio 打开后无故爆红后解决办法

    今天打开AndroidSutudio后表示一脸蒙蔽,项目无故爆红,我本以为是哪里的代码有错导致 报错,于是乎逐个检查,但是并没有发现任何问题,然后CelarProduct,ReBuildProduct ...

  7. android studio 中移除module和恢复module

    一.移除Android Studio中module 在Android Studio中想要删除某个module时,在Android Studio中选中module,右键发现没有delete,如图: An ...

  8. 解决Android Studio中Rendering Problems错误

    android studio提示错误信息如下图: 解决办法: 打开styles.xml文件 在Theme.AppCompat.Light.DarkActionBar前面加上Base. 修改后解决错误:

  9. Android Studio导入项目的中文注释乱码解决方法

           在Android studio中,导入Android的项目后,容易出现项目文件的中文乱码,中文无法正常显示,变成了一些格子问号之类的,导致无法查看中文的注释,下面来看看导入项目和解决乱码 ...

随机推荐

  1. Python @classmethod和@staticmethod装饰器使用介绍

    @classmethod和@staticmethod装饰器使用介绍 by:授客 QQ:1033553122 简介 静态方法:类中用 @staticmethod装饰的不带 self 参数的方法.类的静态 ...

  2. 网站后台getshell

    phpmyadmin后台Getshell 获取 web 绝对路径 select @@basedir; 检测是否有写入权限 show global variables like 'secure%' ## ...

  3. STM32-24位AD7799驱动之手册代码详解,支持模拟SPI和硬件SPI

    1.AD7799介绍 AD7799结构图如下所示: 其中REFIN参考电压建议为2.5V, REFIN电压低于0.1V时,则差分输入ad值就无法检测了,如下图所示: 注意: 如果REG_CONFIG的 ...

  4. MS SQL 批量操作

    MS SQL支持 sysobject,因此可以用以下条件语句查询表对象 select Name from sysobjects where xtype='U' and Name like 'dnt_% ...

  5. js中自执行函数(function(){})()和(function(){}())区别

    方式一,调用函数,得到返回值.强制函数直接量执行再返回一个引用,引用在去调用执行方式二,调用函数,得到返回值.强制运算符使函数调用执行(function(){})(); 是 把函数当作表达式解析,然后 ...

  6. 洛谷 SP263 Period

    洛谷 SP263 Period 题目描述 For each prefix of a given string S* with N* characters (each character has an ...

  7. java将前端的json数组字符串转换为列表

    记录下在前端通过ajax提交了一个json数组的字符串,在后端如何转换为列表. 前端数据转化与请求 var contracts = [ {id: '1', name: 'yanggb合同1'}, {i ...

  8. C# HttpClient设置cookies的两种办法

    前言:最近公司使用HttpClient对象在发送请求,抛弃了之前的HttpWebRequest,使用httpClient有个好处:就是可以只使用一个HttpClient的实例,去完成发送所有的请求数据 ...

  9. (转)go新建文件权限与设置不符

    原文:https://blog.csdn.net/lipengfeihb/article/details/54415283 一. 问题 fileName := "/Users/my/test ...

  10. Access Editor Settings 访问编辑器设置

    This topic demonstrates how to access editors in a Detail View using a View Controller. This Control ...