提交 84757675 编写于 作者: taohebin@dcloud.io's avatar taohebin@dcloud.io

Update uts-for-android.md

上级 f0c6f42a
...@@ -1271,7 +1271,23 @@ ScancodeConfig.setShowLine(false); ...@@ -1271,7 +1271,23 @@ ScancodeConfig.setShowLine(false);
ScancodeConfig.showLine = false; ScancodeConfig.showLine = false;
``` ```
### 6.14 Android原生API过时警告处理
调用原生过时的API插件编译时产生警告,可以使用`@Suppress("DEPRECATION")`添加注解到使用的方法上忽略警告,例:
```js
@Suppress("DEPRECATION")
function getAppName(context : Context) : string {
let appName = ""
try {
const packageManager = context.getPackageManager()
const applicationInfo = packageManager.getApplicationInfo(context.getPackageName(), 0)
appName = packageManager.getApplicationLabel(applicationInfo) as string
} catch (e : Exception) {
e.printStackTrace()
}
return appName
}
```
## 7 已知待解决问题(持续更新) ## 7 已知待解决问题(持续更新)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册