How to expand Android version target version for existing app - android

I have an app in the Play Store that originally targeted API 19+, this was great, then somehow just before Christmas we uploaded a new version that targeted API 21+. Not so much of a problem as an annoyance, but when I uploaded a new version of the app today I got an error on the API 21+ update and was told that I had to have a version that targeted API 23+.
I want to get this app back so it covers all versions of Android from 4.4 > 8.1. But I don't know how.
I uploaded the API21+ apk, and the API23+ version (with different version numbers in the same release (because you have to do that), but the error still persists for the 21+, so I had to remove it to get the update in.
How can I achieve this, currently stuck with an api 23 app, which should be 19.
I am using Xamarin.Forms, in Visual Studio 2017, all of the latest updates, publishing through the web as you can't upload from VS if you need multiple packages in the same release (I don't think).
Thanks everyone.
EDIT
Right, I have the solution to my problem, but I have no idea how to execute it. How do I set the minSdkVersion, maxSdkVersion and targetSdkVersion, using code, in Xamarin and Visual Studio. As the manifest is written at compile time, my options for editing the base manifest wont work (I tried).

You seem to be confusing target SDK and minSDK.
Target SDK says which SDK you used to develop, and have you correctly handled things like runtime permissions which only came in with SDK 23.
You might find this blog post helpful in explaining the differences.
For more information see:
SDK 23 based permissions
Requesting permissions at runtime
It sounds like you want a single SDK with minSDK=19 and targetSDK=23, this is perfectly OK.

So, this seems to be a thing: https://developer.android.com/google/play/publishing/multiple-apks.html
Sadly, you have to edit the manifest manually to create the different versions and then archive it for each release, with a new version number. But it works.

Related

Dealing with Android SDK versions and Targeting

So we are working with Xamarin and it seems that after we upgraded our Android project it seemed to change the Target SDK of our app from 21 to 25. We never noticed this and uploaded an .apk into Alpha Testing.
I later noticed this issue, tried to revert to v21 target and now Google is telling me it cannot because of a breaking permission change in v23 (Marshmallow).
I tried disabling the alpha testing and deleting the v25 target, but that did not work.
I did notice that I could at least downgrade to v23 Marshmallow and carry on with my app release.
BUT: According to usage stats I've looked into I'm cutting off support for appx 15 - 25% of devices (take your pick) by only supporting Marshmallow+...
I've done some research around the issue and haven't found a way to solve it yet. I also emailed Google Support in hopes they can help.
Can anyone shed some light on this?
Thanks!!!
#MoGa suggestion was the correct one. Target v23 and set Minimum SDK to 21. This worked very well, and allows me to continue to target all the devices we need to.

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

Eclipse: How to support older Android Versions?

Is it possible to Support all Android Versions, that exists? How does that work in Eclipse?
You could do that, but you will probably eventually choose not to. Because in the older versions, you don't have all possibilities you now have in the latest version of Android. The API in older versions is very limited.
If you want to do that, you could just use the minSdkVersion in your manifest, that will set the minimal Android version you need to have to run the app.
I suggest you have a look at the following site http://developer.android.com/guide/practices/compatibility.html
Edit: You only need to download the Android version you are locally building against. For example if you say your minSdkVersion is 11, but you're locally building with version 15, that's perfectly okay. You don't need to do anything else for supporting the previous versions. Of course you will need the support libraries too.

Compiling with Android 4.X but supporting API Level 9

I'm working on an application which uses ActionBarSherlock. As it's documentation points out:
[...] the library requires that both it and your project are
compiled with Android 4.0 or newer. The project also requires that
you are compiling with JDK 1.6 in both your editor and any build
systems that you may be using.
So, that means I'll compile my application (and the library) against Android 4.X but in my Manifest, I declare that I'm targeting (e.g.) API Level 9.
This all works fine and well but there is something that disturbs me. From the FAQ:
What API level should I target in my manifest when using the library?
Targetting API level 11 or newer is required as it will cause Android
to automatically add the native action bar when run on newer devices.
Since you will be compiling against new APIs but your app will likely
be run on devices with older versions of Android extra care must be
taken to either avoid using or properly check and call any methods
that were introduced after your minimum SDK version.
That means, that I'll have to manually check every method call, so I don't use any that are not available in my targeted API Level (9 in my case)? This sounds wrong to me.
Is there a way to tell my IDE (IntelliJ), that I'm only using the API Level 9 (so I don't get any auto-completion for non-existing methods/classes and don't use them by accident) and then choose to compile it against another Android version?
Or can I use some automated checks (which run at compile time) to check for that?
The ADT's lint feature should take care of this by warning when API calls are being made for the wrong API version.
You should be compiling both ABS and your project with the latest SDK available (at present, 4.1). Your manifest should have a targetSdkVersion as high as possible (ideally matching your compilation SDK) and your minSdkVersion should be set to the lowest version you support.
Lint is partially integrated with IntelliJ IDEA and is also available as a command line tool.
You temporarily set your target SDK to the various lower ones and debug with it. Your final build then is with the latest SDK.
Set a Build target similar to that you have mentioned in your manifest.
as always , you should set the targetSdk to the maximum available on both the manifest and the project.properties file (as recommended by google on one of their videos) , so that the ADT&SDK would be able to optimize the ADK accordingly.
set the minSdk to the one that you wish to support your app from , and let Lint to tell you if there are any problems in case you use too-new-features.

Android Developer: change version

Is there a way to change the Android version on my app without redoing everything? I just realized that Nook Color only has version 1.4. Well, I have my app set at 3.2 ... so those who have the Nook Color will not be able to access it. Why on earth did I do this to myself!
I am using Eclipse.
You can certainly create multiple .apk files for different versions. See this article about it. However, you may not need to if you haven't used any 3.2 API calls. You may be able to just change the minimum sdk level in the manifest file, update the version code, and republish your app.
You don't have to redo everything , but you can't use 3.2 API on nook color. You'll have to lower your minSDK version in your AndroidManifest.xml to the nook and test your application. If it doesn't compile you can look at using the compatibility libraries allow your app to run on older versions of Android if you are using API calls that aren't available on whatever the nook runs. 1.4 isn't a real version FYI.
http://developer.android.com/sdk/compatibility-library.html
Now you might run into bugs that exist in earlier versions that have been fixed in 3.2. Those bugs might require you rework your features.

Categories

Resources