What is the point of minSDK when using appcompat? - android

I recently started with android development. I don't understand what is the point of specifying minSDK, when I use appcompat?
In my project I've set minSDK to api 19, targetSDK to 19, compileSDK to 19, buildTools to 23.0. And Bam, Android studio automatically linked the appcompat v7-23.0.1. What is the point of setting minSDK to 19 if I can run the app even on api 7 because of the appcompat?

There are still a lot of features in Android introduced on higher versions. For example, API 14 introduced a lot of new features that weren't available before (you can see this page for a list of what's new in API 14), but this is just an example. You can read further about development considerations when deciding minimum and maximum SDK versions here.
Using a higher minSDK also means you are reducing your audience (i.e. how many people can buy that app). You can see a chart showing distribution for versions of Android here.
To answer your question, unless there are specific features from API 19 onwards that aren't in any support libraries, there is no point in keeping it at that - I would lower it to API 14, which means that you have access to most features in Android, as well as any support libraries for any other features you want to add in your app.

What is the point of setting minSDK to 19 if I can run the app even on
api 7 because of the appcompat?
you can not all the time.
where appcomapt fills gap for only a lot of APIs, there are still a lot of APIs which are not supported on lower versions even by appcompat or any other support library.
check documentation for more details.

Related

Are AppCompat frameworks and libraries necessary for new Android projects?

I'm just getting into Android development. I'll be using Xamarin.Android. Reading into this, and having toyed around with Android in the past, are AppCompat frameworks/libraries still necessary? I ask this because it seems that from Nov 1, 2019, all new app submissions require at least API Level 28 as the minimum, so what use would it be to include all these bloated appcompat libraries?
Correct me if I'm wrong or mistaken.
#wpa
AppCompat should not be necessary if you are starting a fresh new project. You can start using AndroidX libraries which will provide backwards compatibility. The requirement being mandated starting Nov 1, 2019 is not for the minimumSdk. It is for the targetSdk version. These are different. You can still have your minimumSdk to the lowest you want, but your app should target at least Android 8.0 (API level 26).
Please follow the link below for detailed information.
https://developer.android.com/distribute/best-practices/develop/target-sdk
Google requires set targetSdkVersion api level in 28 for currently apps in the Google Play Store, but if you are starting a new project, surely will start by default withe the latest android version 29.
Feel free of choose the minSdkVersion in your project.
targetSdkVersion: normally the latest android version available (for example API 29/Android 10)
minSdkVersion: the min Android SDK that your application can run on (for example since 21/ Android Lollipop)
androidx
Other hand, it is still necessary to support previous versions if your plan is to reach the majority of users using new features in old versions of android
However, according to android documentation, developers should be start projects using androidx libraries and not use appcompat library anymore.
Artifacts within the androidx namespace comprise the Android Jetpack libraries. Like the Support Library, libraries in theandroidx namespace ship separately from the Android platform and provide backward compatibility across Android releases.
https://developer.android.com/jetpack/androidx
https://developer.android.com/jetpack/androidx/versions/
https://developer.android.com/jetpack/androidx/migrate (if in the future you find an old project that needs to migrate to androidx libraries)

How to make Android Apps designed for API 22 compatible with API21

I am new to android development and using Xamarin.Android so please keeps terminology simple and relevant if possible.
Current question is, are apps developed for API 22 (android 5.1) compatible with API 21 (android 5.0) by nature - i.e. without adding any package and stuff. If not, how do I make backwards compatibility possible? Thanks.
Typically, you set a minimum SDK value, and a target SDK, and that says what API "range" your app runs against. You additionally compile with a particular SDK version, and that includes the code and resources for the app.
Most of the core API methods and classes are available starting at API 1.
If you want to include libraries, the support libraries should get you backwards compatible back to about API 7.
are apps developed for API 22 (android 5.1) compatible with API 21
If you use classes and methods which were introduced in API 22, then your app will not run on API 21. On the other hand, if you limit yourself to only methods available on API 21, then your app will run on both API 21 and API 22. For newer features, you can use the Support Library.

Will my application be visible to devices higher than my targetSdkVersion in Google Play Store?

I have gone through the following links but they don't provide a clear and definitive answer to my question. This is what I could derive from the answers:
targetSdkVersion indicates that the app is tested against the target version and will run on all android versions from minSdkVersion to targetSdkVersion
with no compatibility issues.
Android Min SDK Version vs. Target SDK Version
what is the difference between "min sdk , target sdk and compile with " ? in android
My app's minSdkVersion=11 and targetSdkVersion=19, Now I am not sure whether devices with higher SDK versions will see my app on Google Play Store or not.
UPDATE: For those who may encounter this question here is a great article I found:
http://www.thedroidsonroids.com/blog/android/compile-min-max-and-target-sdk-versions/
As Android evolves with each new version, some behaviors and even appearances might change. However, if the API level of the platform is higher than the version declared by your app's targetSdkVersion, the system may enable compatibility behaviors to ensure that your app continues to work the way you expect. You can disable such compatibility behaviors by specifying targetSdkVersion to match the API level of the platform on which it's running. For example, setting this value to "11" or higher allows the system to apply a new default theme (Holo) to your app when running on Android 3.0 or higher and also disables screen compatibility mode when running on larger screens (because support for API level 11 implicitly supports larger screens).
Android Developer, So the answer is yes, but you might want to consider testing and updating to current SDK version.
Yes, devices with higher SDK versions will see your app. Features of newer SDKs like granular permissions in Android 6.0 will not be available if they are not supported in your code.
The documentation for android:maxSdkVersion makes the situation clearer:
Warning: Declaring this attribute is not recommended. First, there is no need to set the attribute as means of blocking deployment of your application onto new versions of the Android platform as they are released. By design, new versions of the platform are fully backward-compatible. Your application should work properly on new versions, provided it uses only standard APIs and follows development best practices. Second, note that in some cases, declaring the attribute can result in your application being removed from users' devices after a system update to a higher API Level. Most devices on which your application is likely to be installed will receive periodic system updates over the air, so you should consider their effect on your application before setting this attribute.
It works on SDK 11 and upwards, as in your first Link stated.
Yes. Your app will be visible to the devices with higher sdk versions than your targetSdkVersion.
By specifying targetSdkVersion you can restrict google by applying default compatibility behaviours.So that you will get along with the api level of the device in which your app is running.
Yes, newer devices will see it. Let's do a thought experiment. Let's go back in time one year. We build an app, setting the minSDKVersion and targetSdkVersion to X, the highest available number in the toolset. Six months ago, X+1 got released. And today I just bought a new phone that runs X+1, and I'm very excited! Wait, what? That brand new app isn't in the store? But it worked on my old phone!
That would be crazy. :)
As a more concrete example, here's an app that has minSdkVersion 15
targetSdkVersion 17: https://play.google.com/store/apps/details?id=com.nasarallysport.rallyracetimer I just verified that I can see it in google play with my Nexus 6 on api 23.

Which Android SDK for multi-version support?

If I want to develop an app for API 7 through to 18. I understand I should set minSdkVersion to 7 in the manifest, and I assume I should set 18 as targetSdkVersion. But I'm confused by what SDK I should use for development. Should I be using the SDK for 2.1 (API 7) or 4.3 (API 18)? I don't want compatibility behaviours as I want to completely control and specify what to do on each platform version. And what about the support library? Would I use support libraries 8-18 or 1-7?
(Posted here because development questions are off-topic for android.stackexchange.com)
You can and should use the newest SDK. Eclipse or Intellij will automatically take care of letting you know if you are attempting to use a component that is only available in newer APIs. You will only want to use support library v7 and below since you intend on supporting API 7 and above. A lot of your worries will automatically be taken care of by your IDE. It will let you know if you are trying to use things that are not available in your minimum API level (which you indicate in your manifest file).

The building target and min sdk version

I am trying to make an android app. I am struggle at finding the suitable API level for my first app. I also not sure what min ark version is and what should I type in while creating a new project.
Can someone please answer me how to determine the correct API level and also what exactly is min sdk version??
Thank you
Minimum SDK version specifies that you application will work on minimum that android version and above. It also helps application to be showed on market. So when you put minimum sdk version like 8, your application will work on minimum android version 8 and above.
It's recommended to choose the lower that you use in your application to your "minSdkVersion".
Generally I used the minSdkVersion 7 (= Android 2.1 Eclair) to reach a maximum of people. You can find a pie chart here.
When you develop, do not hesitate to increase your minSdkVersion if you used a new API, you can find the API levels for any methods in the Android reference.

Categories

Resources