How can I define the minSdkVersion for my app?

Is there a minSdkVersion that is common for all Mit App Inventor apps? Or maybe a list of features and which SDK is needed for each?

Please correct me if I'm wrong, but I always thought different features are supported in different SDKs, so for instance if my app includes a feature supported in SDK 11 onwards, then the minSdkVersion will be 11.But I've been unable to find what SDK is needed for each feature in MIT App Inventor. All I found was this answer in the forums where it's stated that the minSdkVersion is 7. Is that correct? If so, does this mean that any features from the core MIT App Inventor (without extensions) that I decide to include in my app will need at least SDK 7 to run my app?

Thanks!

yes
but in case you are using a component or extension, which needs a higher min Sdk, then it will be (should be) adjusted automatically

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

2 Likes

Basically that's true. But it depends on the components and extensions used. Firebase, for example, requires minSdkVersion = 16. So if you use Firebase the minSdkVersion will be 16.

1 Like

Thanks for the quick reply, everyone.
So is there a place where I can check the minSdkVersion for a specific app I create? Or maybe some documentation where it says which SDK version is needed by each component?

What component / extension are you talking about?

None specifically. I would like to know what are the version requirements and where to find them for any project. Maybe it's documented somewhere (with some sort of list of components and which minimum sdk each one needs?) or maybe there's a way to check on an app project and see what's the minSdkVersion needed to run it.

Thanks again!

You can check the minSdkVersion e.g. with β†’ APK Studio Editor.

1 Like

The min SDK for a particular project is computed at compile time by the build server. In theory this is something we could build into the user interface but the easiest way right now is to compile the app and then check it with a tool, such as the one indicated by @Anke.

3 Likes

Hi everyone, a related but not completely identical question : is it possible to edit the minsdkversion in the .aab of the app, instead of the .apk ?

I have an app which is released on the Play store, with a minSdkVersion of 7.

I would like to add a feature which would only be available for devices running 21 or more, as it uses an extension with such a minSdkVersion.

The problem is, just adding this extension (Taifun's AlarmManager, to be exact) automatically puts the minsdkversion to 21, as this is the version required for the extension. But the feature I would add with this extension is nice but certainly not essential, I could easily only offer it to SDK>21 devices and let the other devices run the app as is.

If the release was only done with an apk, I would edit the manifest. But, the release is done through a .aab and compiled by the Store. Is there a way around this ?

If not, I'm faced with the choice of either losing the compatibility with ~2k devices just because I add a very peripheral feature, or not adding the feature at all for everybody. I know the <21 devices are a tiny minority now, but it feels a bit unfair to stop completely the app for those just for a peripheral feature.

Any ideas ?

Here is an extension that declares β†’ minSdkVersion=21 in the Manifest.
The API level can also be queried:
declareMinSdk21.aix (4.2 KB)

Import the extension, drag it into your project and compile (APK or AAB). That's all.

grafik

BTW, what's the problem with making the new feature only available for devices running Android 5+ (API 21+)? If API β‰₯ 21 than ... , else ...

grafik

Of course not with this extension:

but e.g. this:

grafik

Thanks Anke ! but I realize I wasn't very clear in my post, sorry :-(.
What I want to do is:

  • keep (force !) the minsdkversion of the app to 7, in the aab, not in the apk, so that Google Play store doesn't compile the app with a minsdk of 21,
  • and use the if GetApiLevel.SdkVersion > 21 to activate the feature requiring this version only for the phones which are compatible.

I realise that devices running <21 are a tiny minority but I'm not confortable to deprive those users of my app, all for a nice but peripheral feature.

The easiest way is to ask @Taifun to create a special version of his extension for you (for a "small" fee :wink:) that doesn't declare minSdkVersion=21 in the Manifest.

Thanks, will do this : but do you think it will be enough to "trump" the play store ? have no idea how this is handled in the .aab in fact :-/

:question:

As far as I know, once you've updated your app to be a specific minimum version, the Play Store doesn't let you rewind to an earlier min SDK without publishing a new package entirely. Also, the build server uses the same information for generating both APKs and AABs, so I'm not sure that it would be possible to accomplish this with an extension other than if you have an extension that bumps the minSDK and you only include that extension when compiling the item you want to be minSDK 21 and deleting it to create a minSDK 7 version.

Of course.

Where should the problem be if @Taifun removes minSdk = 21 from his extension and leaves it up to the app developer to set the API level from which this feature is possible?

I interpreted the above comment as meaning they wanted the min sdk to be different between the AAB and APK. I was simply pointing out that this is not natively supported by App Inventor--one either needs to modify the manifest after compiling or tweak the components that specify an alternative min sdk between builds.

Ok, but what sense could that make?

He can either upload an AAB or an APK to the Play Developer console. Both is not possible. (The minSdk is of course equally declared in the APK and / or AAB). Unfortunately (AFAIK) a minSdk once declared by an extension can no longer be overwritten/changed by another extension.
In this respect, the only possibility remains that Taifun removes it from his extension.

It can be. Max. of them will be picked as Min SDK of app, so no option to downgrade.