简体   繁体   English

关于最低要求的 SDK ,目标 SDK ,使用 Android 中的选项编译

[英]Regarding Minimum Required SDK , Target SDK , Compile with options in Android

Can anyone explain regarding the Minimum Required SDK, Target SDK , Compile with options while creating an application.任何人都可以在创建应用程序时解释有关最低要求的 SDK、目标 SDK 和编译选项。

  1. If i set the minimum required SDK as API 8, Target SDK as API 16 and Compile with API 17, will it work on Froyo devices in adroid?如果我将所需的最低 SDK 设置为 API 8,将目标 SDK 设置为 API 16 并使用 API 17 进行编译,它是否可以在 android 中的 Froyo 设备上运行?

  2. If i want to use the methods introduced in API 16 or Library uses API 16, and want my app如果我想使用 API 16 中引入的方法或库使用 API 16,并且想要我的应用程序
    to work on Froyo or ICS devices, how can i achieve this?在 Froyo 或 ICS 设备上工作,我怎样才能做到这一点?

    Thanks in advance.提前致谢。

  1. Yes.是的。 But be careful not to include API higher than Froyo in your application但请注意不要在您的应用程序中包含高于 Froyo 的 API
  2. From my understanding, you can't, unless you use third party libraries.根据我的理解,你不能,除非你使用第三方库。
    There are useful libraries out there which help you realise that: ViewPager and ActionBarSherlock .有一些有用的库可以帮助您意识到这一点: ViewPagerActionBarSherlock

You can use API-Level 16 methods only on devices that are Level 16 and higher.您只能在级别 16 及更高级别的设备上使用 API 级别 16 方法。 But you can check in your app and only call them when this is the case.但是您可以签入您的应用程序并仅在这种情况下调用它们。 Look into my small test-app which uses API-11-methods and runs from API-3 and up.查看我的小型测试应用程序,它使用 API-11 方法并从 API-3 及更高版本运行。

http://code.google.com/p/android-change-log/source/browse/trunk/src/sheetrock/panda/changelog/ChangeLog.java http://code.google.com/p/android-change-log/source/browse/trunk/src/sheetrock/panda/changelog/ChangeLog.java

Look at lines 40-41, 144-145 and 324-341.查看第 40-41、144-145 和 324-341 行。 You don't need any third party libraries for this, but you need to put your higher API code in a separate class (lines 324-341).为此,您不需要任何第三方库,但您需要将更高的 API 代码放在一个单独的类中(第 324-341 行)。

Yes ofcourse for first question.是的,当然是第一个问题。 If you use like this.如果你这样使用。

    android:minSdkVersion="8"
    android:targetSdkVersion="16" 

For second.第二。 you can go for third party library if you import it, surely will work.For eg:如果你导入它,你可以去第三方库,肯定会工作。例如:

special features introduced in android 4.0 with tabs and swipe.But to overcome that android 4.0 中引入的特殊功能,包括标签和滑动。但要克服这个问题

actionbar sherlock library been introduced which support in all version and in github .引入了所有版本和github中都支持的actionbar sherlock 库

Hope it helps you.希望对你有帮助。

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

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