Developing for older Android version - android

I want to develop for Android 23 (Marshmallow). I created a new project, modify/remove everything and only use these as my project's components.
Android SDK Build Tools 23.0.3
Android SDK Platform 23
Android Gradle Plugin 2.1.3
Gradle 2.14.1
Target SDK version: 23
Minimum SDK version: 23
Compile SDK version: 23
JDK 1.8.0_211
I manage to get it running on my Android 28 (Oreo) device, but I read it somewhere that the later version of SDK, Build Tools and Gradle provides better security. Should I use all of the latest tools? if so, can I use the latest tools to develop only for Android 23?
Because when I installed Android Studio, it prompt me to target my SDK to 26 since Google Play requires developers to do so. Please teach me the best practice to develop for older Android version. Thank you in advance.

I think you are not aware of what targetSDKversion means.
Let me clarify you. When Google releases a new version of android it brings new features, security and performances improvements. When you configure targetSDKversion then the user can benefit from these improvements while your app still runs on the older version.
For more information:
https://developer.android.com/distribute/best-practices/develop/target-sdk

You do not develop for a single SDK version.
You develop for a RANGE of versions, going from MinimumSDK (yours would be 23) to TargetSDK (minimum of 26 to get into the Play Store, but always best to go the latest possible)
https://learn.microsoft.com/en-us/xamarin/android/app-fundamentals/android-api-levels?tabs=windows

Related

Android version nativescript

I have got android sdk installed and set android_home. In fact I'm developing with ionic and everything is ok.
Now I want to test nativescript but I'm not able to configure it. I installed everything and I get the error:
You need to have Android SDK 22 or later and the latest Android Support Repository installed on your system.
I have android 23 version installed and also 19. I installed also 22 as I read in other pages that nativescript have a problem even if you have an upper version, but even with andorid 22 it doesn't work. Any ideas?
Which OS are you using? Have you installed also Android support repositories from SDK manager?
I have installed Android SDK tools from version 19 to 23, SDK platform-tools and SDK build-tools.

How can I change the defined API version of an Android app?

I am absolutly new in Android development and I have the following problem trying to build a sample project that I have downloaded from Internet.
When I try to build it I obtain the following error message:
Error:Cause: failed to find target with hash string 'android-18' in: C:\Users\Andrea\AppData\Local\Android\sdk
Install missing platform(s) and sync project
So I search online and I found this SO link: Android studio - Failed to find target android-18
Ok so I go into Tools > Android > SDK Manager and infact I have installed Android 6 corrisponding to the API level 23 but not Android 4.3 corrisponding to API level 18.
So what it means? It means that I have installed a different version o the Android framework ?(is it the SDK considerable as a framework or what?)
So, on Android Studio can I install different version of the SDK?
I think that the API level have to be defined in some way into the dowloaded application. How can I specify to this application to don't use the API level 18 but instead it use the installed API level 23 ? I think that it is not a problem because I have installed a newest version that have to support all the stuff of the oldest one, is it?
I will explain the problem a bit for you and then provide you with the solution.
You are facing this problem, because your project is targeting API level 18 to compile the project. So you MUST have API 18 SDK installed to compile the project.
This is why the IDE is complaining that,
Install missing platform(s) and sync project
The SDK is not the framework. The Android framework is same all over, but with different API levels new updates are pushed to the SDK, the latest being API 23, Marshmallow.
You should not download an older SDK to compile the project.
Always try to use the latest SDK available to work with. So, just head over to your build.gradle file or AndroidManifest.xml file and change the compileSdkVersion to 23.
You can either change the compileSdkVersion version in build.gradle to 23 or whatever version you have in your local machine
You can obtain the API Level 18 from the SDK Manager.
I go into Tools > Android > SDK Manager and infact I have installed Android 6 corrisponding to the API level 23 but not Android 4.3 corrisponding to API level 18.
So what it means? It means that I have installed a different version of the Android framework ?
Yes, you have a newer version of the SDK.
on Android Studio can I install different version of the SDK?
Yes, that is what the SDK Manager is designed for
I think that the API level have to be defined in some way into the dowloaded application. How can I specify to this application to don't use the API level 18 but instead it use the installed API level 23 ?
It is defined. Check either the AndroidManifest.xml or the build.gradle file in the module for the app (not in the project root). You should see some combination of minSdk, targetSdk, and/or compileSdk with a number after it. Since you are getting an error about missing SDK 18, then that number will be 18.
I think that it is not a problem because I have installed a newest version that have to support all the stuff of the oldest one, is it?
The support libraries are separate from the core SDK. You cannot run SDK 23 specific code on devices that have a version less than 23, therefore, to be safe, it is recommended that you start with downloading SDK 18, then run it, then try updating the compileSdkVersion number.

Android version downgrade

Please I am trying to build a small android app with ionic but I downloaded android SDK 5.1.1 .
I wish to deploy to a device that has android version 2.3.3 but it won't even build .
It keeps telling me that the target app is android-22. I want it to build for a lower version like android-8.
Please any help will really be appreciated.
I only want it to be able to build for a lower version
I tried to edit the version in the androidManifest.xml files on my project but still I get errors
->First of all, let`s make sure you have downloaded the plateform for Android 2.2 using Android SDK Manager.
->Set android:minSdkVersion to 8 in androidManifest.xml
->Verify the BuidTarget attribute, since it specifies the development tool of which api to provide you.
->Your problem seems to be the absence of API8 in your SDK.
you might need to change your minSdk in build.gradle
in the app build.gradle file set the min sdk version as 8.
defaultConfig {
applicationId "com.etrade.mobilepro.activity"
minSdkVersion 8
versionCode 87
versionName "4.5"
}
Since the app is not building I guess you don't have that particular sdk.I would suggest downloading the sdk through sdk manager.

Android minimum app sdk, required sdks for compilation and compatibility issues

I'm new to android and i want make some things clear about some confusions:
If i set my new android application to a minimum sdk version to 4.0.3 (api 15) should i install all sdks between that version and the latest one ? Or should i just install the sdk level same the device/emulator i will use for testing has as plateform version?
What about when i will generate the final apk for the appstore which will be supposed to work in all android platform versions starting from the min sdk i've targeted ?
i was reading about the Android Support Library and i guess it should be always part of the latest sdk. if i use it on my application should i still have earlier sdk versions installed for the compilation ? Won't i never need anymore packages from earlier API version once i use the support library ?
Best regards.
You do not need the SDK for the minimum version. You only need to work with the SDK of the Target/Maximum version.
Download the platform tools and platform through the SDK manager for the Target API version. And if you use features that are not available in the minimum version, use Android Support Libraries.
The purpose of setting your Minimum SDK is to let devices know if they'll be able to run the code based on what SDK they're using. You don't need to have all versions of the SDK, just the most recent one that you're developing for. If you're using Android Development Studio, it will warn you if a feature you're trying to implement is not supported by the Minimum SDK you've set for the project.

is it necessary to keep older versions of Android SDK installed with Android SDK Manager?

In the Android DSK Manager under "Installed Packages", I see things like:
SDK Platform Android 3.2
SDK Platform Android 3.1
SDK Platform Android 3.0
SDK Platform Android 2.3
SDK Platform Android 2.2
SDK Platform Android 2.1
SDK Platform Android 1.6
SDK Platform Android 1.5
Is it necessary to keep the older SDKs, if I am programming with the latest SDK?
No. You dont need older packages if you are sure about developing with latest packages.
You dont need to keep those packages which your application is not using. Generally you should keep those versions installed which your application is going to use. Like your application may use version from 8 to 10. So no need to keep lower than 8. So that depends on your application which version it will use.
Its too late but I would like to share my experience.
Yes, if you are using Instant Run and using SDK 21 or higher then you should keep SDK Platforms.
For Example, if have deleted the SDK Platform 22 and testing on Android 5.1 device or emulator then Android Studio will ask you to install SDK Platform if you want to use instant run else instant run will not work.

Categories

Resources