调用需要API级别16(当前最小值为14) [英] Call requires API level 16 (current min is 14)

查看:117
本文介绍了调用需要API级别16(当前最小值为14)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码中有这一行:

linearLayout.setBackground(drawable);

setBackground()显示以下错误:

调用需要API级别16(当前最小值为14)

Call requires API level 16 (current min is 14)

这是什么意思?

我可以提高我的API等级吗?

Can I raise my API level?

更高/更低的API级别是什么意思?

What does a higher/lower API level mean?

如果API级别更高,是否限制了我的应用可以使用的设备数量?

Does it limit the amount of devices my app can be used on if the API level is higher?

推荐答案

这是什么意思?

这意味着在API级别16中添加了 setBackground(Drawable)方法,而较早的设备没有此方法.但是,您应用的 minSdkVersion 为14.因此,除非您采取措施避免在API Level 14和15设备上使用此行,否则您的应用将在这些设备上崩溃.

It means that the setBackground(Drawable) method was added in API Level 16, and older devices do not have it. However, your app's minSdkVersion is 14. So, unless you take steps to avoid this line on API Level 14 and 15 devices, your app will crash on those devices.

我可以提高我的API等级吗?

Can I raise my API level?

您可以将 minSdkVersion 设置为16.

如果API级别更高,是否限制了我的应用可以使用的设备数量?

Does it limit the amount of devices my app can be used on if the API level is higher?

是的.如果您说您的 minSdkVersion 是16,则运行版本早于该版本的Android的设备将无法运行您的应用.

Yes. If you say that your minSdkVersion is 16, then devices running a version of Android older than that cannot run your app.

在撰写本文时,访问Play商店的Android设备中约有90%是在API级别16或更高版本上(即运行Android 4.1或更高版本).

At the time of this writing, about 90% of Android devices accessing the Play Store are on API Level 16 or higher (i.e., are running Android 4.1 or higher).

您可以在文档.请注意,该文档有点陈旧,因为它着重于清单中定义的 minSdkVersion .在Android Studio项目中,通常在您的 app 模块的 build.gradle 文件中定义 minSdkVersion .

You can read more about the concept of API levels in the documentation. Note that this documentation is a bit old, in that it focuses on the minSdkVersion being defined in the manifest. In Android Studio projects, minSdkVersion is usually defined in your app module's build.gradle file.

这篇关于调用需要API级别16(当前最小值为14)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆