简体   繁体   English

您应该选择哪个构建目标和最低SDK版本?

[英]What build target and min SDK version should you choose?

Hey, I'm building just a basic app with text, urls, pictures, and some buttons. 嘿,我正在构建一个带有文本,URL,图片和一些按钮的基本应用程序。 When you create a new project what build version do you usually choose? 创建新项目时,通常会选择什么版本? The highest, 2.2? 最高的2.2? And also what min SDK version do you choose? 以及您选择的最低SDK版本是什么? Also 2.2? 还有2.2吗? or the lowest one possible? 还是最低的?

I'm a little confused by what would be best for all customers 我对所有客户的最佳选择感到困惑

-Thanks! -谢谢!

You should choose what you want to support. 您应该选择要支持的内容。

If you want the latest API features, choose 2.2 (or soon 2.3). 如果要使用最新的API功能,请选择2.2(或不久之后为2.3)。 But if you want to include all possible phones, you need to go as low as 1.5 for the min target. 但是,如果要包括所有可能的电话,则最低目标值必须低至1.5。 The catch is that if they are using a 1.5 device you have avoid making API calls that only exist in a later version of Android. 要注意的是,如果他们使用的是1.5设备,则可以避免仅在更高版本的Android中存在的API调用。

My two cents worth is that I am also investigating this question. 我的两分钱是我也在调查这个问题。 With the exception of this page, I also found the following official statistics to be helpful. 除此页面外,我还发现以下官方统计信息对您有帮助。

http://developer.android.com/resources/dashboard/platform-versions.html http://developer.android.com/resources/dashboard/platform-versions.html

Also, if you already have applications published in the market you can get data on how your specific application is perceived by your audience, this may help you to choose. 另外,如果您已经在市场上发布了应用程序,则可以获取有关特定应用程序如何被受众感知的数据,这可以帮助您进行选择。

From a personal perspective, at the time of writing I am going to set my minimum version to 2.2 as this is the minimum API level required to write applications that use OpenGL ES 2.0. 从个人角度来看,在编写本文时,我将最低版本设置为2.2,因为这是编写使用OpenGL ES 2.0的应用程序所需的最低API级别。

(slightly off topic, but to qualify the statement about OpenGL ES 2.0 http://developer.android.com/resources/tutorials/opengl/opengl-es20.html ) (稍微偏离主题,但要限定关于OpenGL ES 2.0的声明http://developer.android.com/resources/tutorials/opengl/opengl-es20.html

It just depends on what you want to do. 这仅取决于您要做什么。 If you want to support multiple Android versions then do what Falmarri said. 如果您想支持多个Android版本,请执行Falmarri所说的。 Select the lowest API version you want to support for minSDK and choose the API version you are targeting for the buildTarget . 选择您要支持的最低API版本minSDK ,并选择你的目标API版本buildTarget

However you have to keep in mind that you might have to handle certain stuff in a different way for different API versions which might require if-else blocks checking for the API version. 但是,请记住,对于不同的API版本,可能必须以不同的方式处理某些内容,这可能需要if-else阻止检查API版本。 It is nothing hard to do nor something magic just keep it in mind and check the reference page on the classes and methods you use. 这样做并不困难,也别无所求,只要检查一下所用类和方法的参考页即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM