创建 Android 应用程序时,我必须选择“编译方式”API 选项。该选项的帮助说明我通常使用最新版本,或者第一个支持我想使用的所有 API 的版本。
我有以下问题:
*据我所知,最新的 API“包含或支持”(不确定是否因为使用了 Android 支持库)以前的 API。这使得不必下载以前的 API 来编译具有一些以前的 API 要求的 android 项目?
例如,假设我要创建一个“目标 SDK”为 GingerBread 的应用程序,在这种情况下使用最新的 API(Jelly Beans)作为“编译 API”是否是一个好习惯?我想问题可能出在使用仅适用于 JellyBeans 的 API,但 Lint 可以帮助解决这个问题。
*如果上面的问题是真的,我只需要下载以前的API就可以运行那些版本的模拟器?
谢谢!
最佳答案
as far i as understand, the newest APIs "contains or support" (not sure if its because of the use of Android Support Library) the previous APIs.
一般来说,这是正确的。
This makes unnecessary to download a previous API to compile an android project which has some previous API requirements?
一般来说,这也是正确的。
For example, lets say im gonna create an application whose "Target SDK" is GingerBread, is it a good practice to work with the latest API (Jelly Beans) as the "compile API" in this scenario?
这样做没有错,只要您将 android:minSdkVersion
设置为您想要的。
I suppose that the problem could be to use an API that is only available for JellyBeans but Lint can help to solve that.
正确。
If the above question is true, I only need to download previous APIs only for running the emulator with those versions?
正确。具体来说,您正在寻找 SDK 管理器中的“...系统镜像”条目,至少是 ARM 和 x86 条目。
关于android - 在 Android 应用程序中选择 "Compile with"API 选项的良好实践,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14940395/