2014-03-28 81 views
-5

我想作一個Android應用程序。我只是個初學者。正如我在第一階段,我需要知道,如果我做一個App 2.2版本將它用於2.2和它上面的作品嗎?哪個版本選擇

+4

**「如果我做一個App 2.2版本將它用於2.2和它上面的工作?」 **:簡而言之,是的。除非您使用支持庫,否則您將無法使用任何較新的Android功能。 – Squonk

回答

1

你應該考慮多個細節。

從官方Android開發者網站:

應用程序可以使用該框架API 提供一個清單元素 - - 形容 下的最小和最大API級別,他們都能夠運行,以及作爲 設計用於支持的首選API級別。該元素提供了三個關鍵屬性:

android:minSdkVersion — Specifies the minimum API Level on which the application is able to run. The default value is "1". 
android:targetSdkVersion — Specifies the API Level on which the application is designed to run. In some cases, this allows the application to use manifest elements or behaviors defined in the target API Level, rather than being restricted to using only those defined for the minimum API Level. 
android:maxSdkVersion — Specifies the maximum API Level on which the application is able to run. Important: Please read the <uses-sdk> documentation before using this attribute. 

可以定義一個目標SDK版本,最大和最小的SDK版本。這意味着你的應用程序將從minSDKVersion運行到maxSDKVersion。

你可以在你的Manifest.xml進行定義。 要了解有關該屬性的更多信息,並瞭解您的決定有哪些優缺點,請選擇this

1

與以前的版本相比,每個新的Android版本都提供了一組額外/增量功能(API)。因此,爲2.2創建應用程序會限制您使用「現代」功能(因爲它尚未提供/添加)。

如果你不需要任何Android 2.2+的功能,那麼你設計的應用程序爲2.2,它會(最有可能)在更高版本的Android上工作。

請注意,部分的'現代'功能由(舊版本的)向後兼容support libraries提供。所以你仍然可以使用這個功能。