Torben
Torben

Reputation: 5494

How to build for older Android SDK version?

I have an older Android app, which I need to test. It has this preference in the config.xml

<preference name="android-targetSdkVersion" value="29" />

Now, I've installed:

java -version returns:

java -version
java version "1.8.0_411"
Java(TM) SE Runtime Environment (build 1.8.0_411-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.411-b09, mixed mode)

I removed all Android SDK stuff from Android Studio which has an API level > 29.

When I ask cordova requirements, I get this:

legacy-app on  main [$!] ➜ cordova requirements
android-targetSdkVersion should be greater than or equal to 34.

Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: not installed
Please install the Android SDK Platform "platforms;android-34"
Gradle: installed /opt/homebrew/Cellar/gradle@6/6.9.4/bin/gradle
Some of requirements check failed

But why is Cordova asking for version 34? I want to build a legacy version and the build process should use the legacy jdk and gradle version and also the legacy android sdk.

Can someone guide what I need to do here? Thanks!

Upvotes: 0

Views: 60

Answers (1)

Eric
Eric

Reputation: 10658

You need to target API Level 34 in order to publish to the Play Store, and if you are using the latest version of Cordova and cordova-android. To support older SDK's, set the minSdkVersion in your config as well

<preference name="android-minSdkVersion" value="29" />
<preference name="android-targetSdkVersion" value="34" />

Upvotes: 0

Related Questions