[英]call requires api level 9 (current min is 7) java.text.normalizer#normalize
I finished this game a month ago, and everything worked fine until today. 我是一个月前完成游戏的,直到今天一切都还不错。 I get error on line: 我在网上遇到错误:
odgovorNormalized = Normalizer.normalize(konResenje, Normalizer.Form.NFD).replaceAll("[^\\p{ASCII}]", "");
If I go to manifest file and change API level to anything, even to 6, I don't get error anymore. 如果我转到清单文件并将API级别更改为任何级别,甚至更改为6,我都不会再出错。 Until I change something in my code. 直到我更改代码中的内容。
I've just remembered that I changed encoding of my project to Latin today. 我刚刚记得我今天将项目编码更改为Latin。 I don't know if that has anything to do with this. 我不知道这是否与此有关。
Everything worked fine until today. 到今天为止一切正常。
The error is picked up by the static code analysis tools. 该错误由静态代码分析工具接收。 Yes, it will compile, Yes, it will run. 是的,它将编译,是的,它将运行。 Yes, it will crash during runtime on any device with API < 9. 是的,它将在运行时在任何API <9的设备上崩溃。
The proper thing to do is switch on the API: 正确的做法是打开API:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
/* Use Normalizer normally */
} else {
/* Fall back on some default behavior */
}
You can suppress errors like this, but always make sure you've fixed them first: 您可以抑制这样的错误,但始终确保先修复它们:
@SuppressLint("NewApi")
public void methodThatUsesNewAPI() {}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.