I'm beginner in Android coding and i don't know if i need to create my first application by coding on Android SDK 2.2 or 7.1 (the latest version right now). To make it clear, I will create an application to run on any type of android smartphone. Thank you.
-
Code to the latest version, and use android:targetSdkVersion="19" (if needed) in the manifest to run it without "compatibility behaviors". The 19 you change to what you want. See also minSdkVersion and maxSdkVersion. – Jon Goodwin Nov 23 '16 at 23:41
-
i used the targetSdkVersion as 19 as you said, but there is a lot of errors when i try to create the project, and here you can see one of them: [2016-11-24 00:49:05 - AndroidTest] C:\Users\torai_000\workspace\AndroidTest\res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'. – Terai Nov 23 '16 at 23:52
-
you need to create a project for v7/appcompat from .../android-sdk/extras/android/support/v7/appcompat and link the project and library (resource based library). http://stackoverflow.com/questions/21059612/no-resource-found-that-matches-the-given-name-style-theme-appcompat-light – Jon Goodwin Nov 24 '16 at 01:25
-
I gave you some points, it's a good question. – Jon Goodwin Nov 25 '16 at 03:43
1 Answers
Per the Picking your compileSdkVersion, minSdkVersion, and targetSdkVersion blog post:
Therefore it is strongly recommended that you always compile with the latest SDK
Therefore you should compile with Android 7.1
minSdkVersion is the lower bound for your app
Generally, libraries you use will have a minSdkVersion - your app won't be able to support anything lower than that. Google Play services, for example, currently has a minSdkVersion of 9 (although it is increasing to 14 soon)
targetSdkVersion is the main way Android provides forward compatibility by not applying behavior changes unless the targetSdkVersion is updated
And your targetSdkVersion is best set to the highest level of Android you've tested your app on.
You'll note the conclusion of the article:
Ideally, the relationship would look more like this in the steady state:
minSdkVersion (lowest possible) <= targetSdkVersion == compileSdkVersion (latest SDK)

- 191,609
- 30
- 470
- 443