minSdkVersion removal effect

Hi.

To comply with Google Play Store, we have to use minSdkVersion

This causes older phones not to be able to run apps.

Recently I had to put this value in build.settings file, and rebuilt the apk, and uploaded it to google play store

I did not change anything in the code, only this line, and some users are unable to download the app.

I can eventually send users the apk file using a download link, but should I remove this line from the build? or should I keep it?
Does it really make a difference in the build itself (compilation), or is it something only controlled by google play store by matching SDK level and phone type

According to the Android documentation:

The Android system prevents the user from installing the application if the system’s API level is lower than the value specified in this attribute.

If you don’t declare this attribute, the system assumes a default value of “1”, which indicates that your application is compatible with all versions of Android. If it isn’t, and you didn’t declare the proper minSdkVersion, then when installed on a system with an incompatible API level, the application crashes during runtime when attempting to access the unavailable APIs.

From what I understand, they suggest declaring a minimum version. Otherwise, this might affect your users and you, in the end.

(I have no idea why the preview is in Spanish.)

If you want to keep user devices playable below the minimum version required by GP, then you need to create two APKs:

  1. For GP, make sure minSdkVersion meet the requirements;
  2. For user (devices) whose versions are below GP’s minSdkVersion requirement, remove the minSdkVersion declaration, so they can continue to install the apk you sent (but they can’t search for your game on GP).

Just be sure you are not mixing minSdkVersion with targetSdkVersion.

Solar2D default value for minSdkVersion should be 15, Android 4 (if the doc is up-to-date now that I checked it)

So you need to set a higher minSdkVersion only if you use more recent Android APIs or if your goal is to exclude old devices.

Some plug-in might force a higher value and that’s because it uses some APIs that weren’t available in earlier versions.

So basically: don’t set minSdkVersion unless you know what you are doing

Hi Stefano,

I only use this feature to comply with Google’s API level targeting.
I never knew about targetSdkVersion. where should i type it? in build.settings?

The problem is if you remove it, Google threatens to remove the App from playstore by August 31st
That’s why I did it

Maybe this will be more helpful:

minSdkVersion is controlled by you to limit old devices.

targetSdkVersion is something that needs to be updated once a year by those who maintain the official version of Solar2D… Specifically:
API 33 is supported in the latest Solar2D version, so you now can just build your game with it.
Don’t try to set the value in build settings or whatever. Just build your game using last Solar2D version.
Solar2D builder will set the proper value of targetSdkVersion for you.

I have modified and added the below lines and uploaded to GP Store and it worked! thanks

targetSdkVersion = "31",
minSdkVersion = "15",

You mistyped 33, but despite that, you can remove both entries completely :sweat_smile:

If I remove entries google play store will warn me

I didn’t misstype … i thought Solar2D reached this far so far!

They warn you only if you build with an old version of Solar2D

I didn’t know that :grin:

I will check it out, many thanks

Read my messages again please.
My English is bad but I told you everything you need to know. If something is not clear just ask🙂

Ya you are right.

Things just got mixed up a little bit for me, because sometimes you just copy and paste a line from the internet without caring about what it does just to solve your problem quickly and move on.
Sometimes build crashes if you don’t put minSDK, and google warnings make things worse, and when mixed together you face problems just like what happened to me

1 Like

That’s perfectly normal.
Would be useful if they’d stop messing with the sdk for a couple of years :joy:

1 Like

Do you have a clue on the attached?

Apk is accepted, aab is not

When i build for android i get 2 files: apk and aab

I just drag and drop them, aab is rejected

the standard format for upload is now AAB, so just ignore the apk, unless you have a reason to upload it.

The error is pointing out that you didn’t update the version code when you built (11), but maybe it’s just that the apk and the aab have the same number. If it is so then I guess they need to be built separately, with a different code for each.

…still I wouldn’t upload an apk if there’s no reason to do so.

I truly didn’t know that :grin: :grin: :grin:

I always drag and drop both files generated by the build

I didn’t know that the AAB file does the job

This is funny … i have been building and publishing for the past 10 years and never knew that

Thanks a lot man

1 Like

AAB is only required if your app is over 150MB. But it is more efficient, so for updates, APK will be the entire build, AAB will only be the changes.