Android SDK - What to download? - android

I want to develop android applications, i've downloaded all the necessary.
One last question:
if i decided to create apps that are compatible with for example starting from API 11 and later, what is the strict necessary i need to download from Androis SDK Manager?
I need to download all?
What are Android SDK build-tools?
What are other downloads in the list?
Can someone post a screenshot of strict necessary scenario to do what i'm need?
thank you

You don't need to download all Android SDK, just get Android 3.0 (API 11) and Android 5.0 (API 21) and declare the min and max targetsdk in the manifest file.

you have to declare your desire version using this line
<uses-sdk android:minSdkVersion="integer"
android:targetSdkVersion="integer"
android:maxSdkVersion="integer" />
in manifest file. for more info check this out http://developer.android.com/guide/topics/manifest/uses-sdk-element.html
EDIT
you don't have to download anything for make strict versioning.
android:minSdkVersion
Like the name suggests, defines the minimum API level your application works on. This is used by Play Store to detect if the application is compatible with the users device. So, if your minSdkVersion is 7, Play Storewill show the application to devices from API level 7 (2.1) and up. This attribute should be set by all apps!
android:maxSdkVersion
This defines the maximum API level your application works on. Again, Play Store uses this to detect if an application is compatible with a device. Please note, that there in most cases is no reason to use this! it is perfectly possible to create a single APK which works on every API level from your minSdkVersion and up!
android:targetSdkVersion
Unlike the other two attributes, this is used by the Android platform itself. This attribute should be set to the maximum API level you tested your application on. If not set, this will default to your minSdkVersion.
you can also visit this to get more details http://simonvt.net/2012/02/07/what-api-level-should-i-target/

Related

Firemonkey: can we update targetSdkVersion in AndroidManifest.template.xml?

I read that berlin is compatible with marshmallow, but i see that by default in the AndroidManifest.template.xml we have :
<uses-sdk android:minSdkVersion="%minSdkVersion%" android:targetSdkVersion="%targetSdkVersion%" />
i don't know where delphi took the variable to update %targetSdkVersion% but it's seam to be all the time 14 and i don't see any way to configure it
i would like to replace %targetSdkVersion% by 23 (marshmallow api level, to support the app permissions), but is it safe to do so or it's will introduce many other bug ?
FireMonkey was developed to work against a certain range of Android functionality. As you can see from the RAD Studio Platform Status page FireMonkey apps built with Delphi 10.1 Berlin have a lowest supported Android version of 4.0.3, which corresponds to Android API Level 15.
The minSdkVersion field is supposed to be set to the earliest Android version your apps will work with so in truth this should probably be set to 15 but actually is set to 14 (Android 4.0-4.0.2).
If you look back at an Android manifest file generated by Delphi XE7, which supported Android 2.3.3 (API Level 10) it specifies a min SDK version of 9 (Android 2.3-2.3.2), which is the version of Android that introduced the NativeActivity type underlying every Delphi FireMonkey Android app. Again, this seems a little bit out of kilter with what is documented as lowest supported version.
Anyway, minSdkVersion can be used by Google Play store to filter your app out of the listings for someone running a lower version of Android. It is also checked when you install an app on a device; Android won't let you install on a lower version of Android.
targetSdkVersion, on the other hand, indicates what version of Android your app has been tested with and works sensibly with. It can often be higher than minSdkVersion if your your app needs to use features introduced in Android versions later than minSdkVersion.
If you want to use a feature from API Level 23 then sure, you'll need to update that manifest part. Just remove the %targetSdkVersion% template from the Android manifest template file and replace it with the required version.
Problems that you might run into:
You'll either need to check the Android version and, if lower than your targetSdkVersion, not use those features that aren't available or set minSdkVersion to a suitably higher version to ensure the app can only run on devices that have the features you wish to use.
FireMonkey code not aware of differing behaviour in API Levels may
function adversely. In your case you may get issues because of the
different runtime permissions behaviour enabled in API Level 23.
Actually I can't currently think of any more issues, though a good amount of testing is recommended. You might have more to think about in a regular Android app using visual activities and so on, when different API levels may affect the theming or other UI elements. You can see the various things that change when you target target SDK versions on this Android documentation page.
By the way, the use of the SDK Manager in the Tools. Options... dialog is entirely irrelevant to the question of how to update the value in the generated manifest file. The only evident way to change it is to manually edit the Android manifest template file as per the documentation, and mentioned in a comment.
The only relevance of the SDK Manager is that the default Android SDK installation for Delphi 10.1 Berlin installs the Platform libraries for API Level 22. If you want to use a feature from API Level 23 you might think that updating those platform libraries might be necessary, but of course if you're doing the coding in Delphi then you're (presumably) actually just compiling against import definitions of the features in that higher API level, and so whether or not those features are contained in the android.jar file is of no consequence.**
** I'm happy to be proved wrong on this count, but I have never observed a connection between the manifest and what the SDK Manager is set up against.

Choosing SDK version to reach maximum number of people

I am a complete beginner in Android Development and just downloaded Android SDK to integrate it with Eclipse.
However, I don't know which Android version I should select in SDK Manager to allow a maximum number of people to download and use my app.
Here's a screenshot of the manager that is showing up on my screen.
Any kind of help would be really appreciated.
Thanks.
In fact, you don't need to download an OLD SDK just to allow OLD Devices to use your app.
This is done in your project settings via target SDK version and min API level(AndroidManifest.xml or build.gradle).
Define Audience
First, define the audience to your app.
HERE you can find the market share for every Android Version (this can change for each country but it may help).
If you check that table, you can see that only few devices are still using API 15 or older.
So, if you support API<15, you will only reach ~3% more people. If you can support them without lose any feature, good (not all android features are supported/ported to all versions). But if you may need to disable a feature (like that special Floating Action Button that you created) just to reach those devices, I think it does not worth.
So, based on that table, you define the audience
In my case for example, I like to build apps for devices with API from API_16 to API_24.
Usually, we always want to use maximum API available. Today, 24.
This way, I could reach ~97% of the people using Android.
But this is optional... I could select min API as 13... or 14.. or 4.. This is up to you..
After defining the audience
Target SDK
I usually set the target API according to the MAX API I want to support. So, for example, if the MAX API I want to support is API_24, this will be my target API and will download the SDK v24 (7.0).
Usually, you always will have the latest SDK installed since you always want to reach latest android version and enjoy all the new features.
MIN API
Now, you also have defined the min API version that you want to support. So, lets use API 16 for example (first JB version).
You will set this in your project file (AndroidManifest.xml). You don't need to download SDK 16 just because of that.
Setting Eclipse
As I said, min SDK will be set in your project. That would be done in your Android Manifest
Here, you can see that targetSdk is 24. It means that I just need to download SDK v24 to build this project. Even then, I'll be able to install this App in devices with API 16 or later.
Eclipse (AndroidManifest.xml)
<manifest>
....
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="24" />
...
</manifest>
Android Studio (build.gradle)
compileSdkVersion 24
buildToolsVersion "24.0.0"
minSdkVersion "16"
targetSdkVersion "24"
minSdkVersion Does Not Guarantee that your app will work
Note that settings above only allow your app to run in devices with API>=16 or API<=24. However, your app may crash or does not work in all devices within that range. This usually happens because some View Components or Methods were added or removed according to API version.
For example, Fragment was added only on API11. So, if you try to install your app in a phone with APIv11, it will work. However, if you install it in a device with API4, it will crash.
Another example is method Fragment.onAttach(Context context) which was added only in API 23.
That's why we use Support Library
Support Design Library it is a library created by Google which enables the developer to use features from new Android Versions in old Android versions.
So, for example, to add a Fragment which is compatible with devices with API<11, you should import and use Fragment class from package android.support.v4.app.Fragment instead of default version included in SDK (android.app.Fragment).
This way, your app wont crash.
Of course this is very basic example. It is just to illustrate...
Anyway, I hope I could help you
Regards

is it possible to mention the Android Version of Device to be filtered in Manifest file?

I learnt i can filter out devices to which my android application is available by using
certain conditions in Manifest file.
But is it possible to specify the Android Version used in the device as a filter?
Scenario :
i actually wan to restrict device based on Android version used in the device..
for example in Galaxy S3 the android Version is 4.0.4...
so if i do the configuration, the only devices with Android version 4.0.4 will be able to download my app in Google store..
if so please suggest.
Your question is unclear to me.
This is how you can set which version of Android can install your app.
<uses-sdk android:minSdkVersion="integer"
android:targetSdkVersion="integer"
android:maxSdkVersion="integer" />
Note: The version numbers are SDK version NOT the Android versions.
Refer docs for more details. Here you can also see what SDK Level corresponds to which Android Platform version.
You use this element in the manifest fo accomplish that, have a look at the Android developer's site:
<uses-sdk>
Lets you express an application's compatibility with one or more
versions of the Android platform, by means of an API Level integer.
The API Level expressed by an application will be compared to the API
Level of a given Android system, which may vary among different
Android devices.
Yes, as like above suggested answers we can restrict using uses-sdk
Below screen shows, which API Level represents which Android Version.
This should be useful to some one.
This can be seen in android SDK Manager.

Easy way to detect android:minSdkVersion automatically?

I'm not too familiar with which features belonging to which android version. Is there an easy way to discover the lowest version of android that my app can run in?
You can do it with lint tool.
Try to set minSdkVersion to 1 and run lint.
It'll show all methods and objects which later API is required for.
The minimum SDK version is the one you declare in your manifest for example the following line will set the minimum SDK version of your app to 7.
you can't discover like this. If you want to test your app in all versions of avds
set your app minSdkVersion to 8 and targetSdkVersion to 15
create all all versions of Android Virtual machines(avd) which you want to test
run your app in all versions of avds which you have created by selecting android target
No way to do it programmatically.
android:minSdkVersion — Specifies the minimum API Level on which the application is able to run. The default value is "1".
Before setting the minimum sdk version please check the scenario here. You can detect it programmatically .
http://developer.android.com/about/dashboards/index.html
what do you mean by detecting.. its up to you that which minimum api level you want your app to be supported. select any android:minSdkVersion e.g 8,10 etc. If any of the feature you are using which is not supported on this api level Eclipse will automatically tell, else use Android Lint

Is there a way to change a project from using API 12 to API 8

I set up my project to use Android 3.2 (API Level 12), but it seems like a lot of phones are still using Android 2.2 (API Level 8).
Is there a way to change my project from only supporting Android 3.2+ to supporting back to Android 2.2?
yes...just change the minsdk number in the manifest. You have to be sure that you don't use any feature that is not supported though...
in your AndroidManifest.xml add this line:
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16" />
android:minSdkVersion tells the Store what the minimum version you are targeting is. In this case 2.2. Devices less than 2.2 won't be able to download your app.
android:targetSdkVersion tells the store what the best version you are developing for is. In this case 4.1. Devices over 4.1 can still download your app but certain features may run in compatibility mode.
NOTE: When you setup your project to use 3.2, all you did was select the Android SDK you wanted your IDE to use when checking and compiling your code. Without the uses-sdk line in your manifest you've targeted nothing.
Right Click Project -> Properties -> Android -> Select SDK version
Update Manifest, min/target api. (as others have described by others).
Go to your Manifest.xml file and edit the minSdkVersion to 4. That will set it way back to 1.5 or something like that :). You can make that number higher if you want to suit a higher API, but I like compatibility.

Categories

Resources