简体   繁体   English

调用需要api级别9(当前最小值为7)java.text.normalizer#normalize

[英]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.

相关问题 调用要求API级别21,当前最小值为8 - Call requires API level 21, current min is 8 调用需要API级别26(当前最小值为23):java.time.Instant#now - Call requires API level 26 (current min is 23): java.time.Instant#now 错误:调用需要API级别23(当前最小值为15): - Error : Call requires API level 23(current min is 15): 错误:调用需要 API 级别 24(当前最小值为 21):java.util.Map#forEach [NewApi] - Error: Call requires API level 24 (current min is 21): java.util.Map#forEach [NewApi] 调用要求API级别16(当前最小值为14),并带有EndAction - Call requires API level 16 (current min is 14) withEndAction 需要API级别21(当前最小值为16) - Requires API level 21 (current min is 16) 调用需要 API 级别 23(当前最小值为 22)同时从应用程序发出调用请求 - Call requires API level 23 (current min is 22) While making a call request from App 调用需要API级别11(当前最小值为8)android.app.Activity#onCreateView - Call requires API level 11(current min is 8) android.app.Activity#onCreateView 调用需要API级别11(当前最小值为8):android.app.Activity#onCreateView FragmentActivity - Call requires API level 11 (current min is 8): android.app.Activity#onCreateView FragmentActivity 如何修复 Android 中的“呼叫需要 API 级别 26(当前最小值为 25)”错误 - How to fix "Call requires API level 26 (current min is 25) " error in Android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM