'Android application install warning (built for older version)

I followed this tutorial to build Android application from command line. This is my batch script to build and install the application on my device using USB debugging.

aapt package -f -m -J build\gen\ -S res -M AndroidManifest.xml -I "%ANDROID_HOME%\platforms\android-30\android.jar"

javac -source 1.7 -target 1.7 -bootclasspath "%JAVA_HOME%\jre\lib\rt.jar" -classpath "%ANDROID_HOME%\platforms\android-30\android.jar" -d build\obj build\gen\net\hanshq\hello\R.java src\net\hanshq\hello\MainActivity.java

java -jar "%ANDROID_HOME%\build-tools\30.0.0\lib\dx.jar" --dex --output=build\apk\classes.dex build\obj

aapt package -f -M AndroidManifest.xml -S res\ -I "%ANDROID_HOME%\platforms\android-30\android.jar" -F build\Hello.unsigned.apk build\apk

zipalign -f -p 4 build\Hello.unsigned.apk build\Hello.aligned.apk

call apksigner sign --ks debug.keystore --ks-key-alias androiddebugkey --ks-pass pass:android --key-pass pass:android --out build\Hello.apk build\Hello.aligned.apk

adb install -r build\Hello.apk

adb shell am start -n net.hanshq.hello/.MainActivity

I use OpenJDK-17, Android-30 platform version, and Android 30.0.0 build tools version.

This is the AndroidManifest.xml file.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="net.hanshq.hello"
          versionCode="1"
          versionName="0.1">
    <uses-sdk android:minSdkVersion="30"/>
    <application android:label="Hello">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>
</manifest>

What I want to ask is when I set the minSdkVersion to 30 it installed fine on my device. But, when I set it to a lower value like 21, it still installed correctly but output a warning popout like this.

This app was built for an older version of Android and may not work properly. Try checking for updates, or contact the developer.

What I want to ask is this warning related to value of minSdkVersion or is it because the version of Android SDK platform and build tools that I used? Thanks in advance for the answer.

Edit: My device is running Android 11 OS



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source