How to compile Cordoba apps for older versions of Android

I installed the version of corova-android version 7.0.0

My application should work in Android 4.1.1

So, I added the platform with:

cordova platform add android@4.1.1 

Then I get:

Using cordova-fetch for cordova-android@4.1.1 Adding an android project ... Unable to download PlatformApi from the platform. Error: The unhandled error event. (It does not seem to implement the Api platform.) Error: The package name should look like this: com.company.Name

Any tips?

+5
source share
5 answers

The original question has been edited, and now it asks for support for Android 4.1.1 (SDK 16), not SDK 19 as the original answer.

To support Android 4.1.1, you can use cordova-android 7.0.0 or later, cordova-android 7.1.0 increased the Min SDK to 19.

ORIGINAL RESPONSE:

First of all, even the latest version of corova-android (7.1.0 at the moment) still supports SDK 19 and newer, so I'm not sure why you want to switch to 4.1.1.

Now, to get it working with cordova-android 4.1.1, you need the old Cordova CLI, because the new CLIs require new platforms and are not compatible with very old ones, such as 4.1.1.

So, install CLI 5.4.1 Cordoba with

 npm install -g cordova@5.4.1 

After that, you can add the cordova-android 4.1.1 with

 cordova platform add android@4.1.1 
+4
source

Update node and cord as the last.

 npm install -g cordova 

and add android version 6.2.3.

 cordova platform add android@6.2.3 

This version now works great.

+3
source

Install Andorid Level 19 Platform API from Android SDK Manager

Install a stable cord:

 npm install -g cordova@7.0.0 cordova platform add android 

Add this inside the <widget>...<widget/> in config.xml:

 <preference name="android-minSdkVersion" value="19"> <preference name="android-targetSdkVersion" value="19"> 

Make the following changes to build.gradle :

 defaultMinSdkVersion=16 defaultTargetSdkVersion=19 defaultCompileSdkVersion=19 

Make the following change to project.properties :

 target=android-19 

Run your code:

 cordova run android 
+2
source

The platform version for the Android platform from Cordoba is not the same as the version of Android that your phone should run.

The Cordova platform version supports a number of Android OS versions. You can find an array of supported Android versions for each version of the corova android platform on the Codova Android platform manual page .

Cordoba and Android platforms version 6.x support Android versions from 4.1 to 7.1.

For the Android cordon platform version 7.x, the minimum version is set to 4.4, so the platform version 7.x cannot be used if you need to support phones older than Kit-Kat (the minimum sdk has been changed).

All you need is version 6 of the cordon platform tools, not 4.1.1, so it should work fine with the following line:

 cordova platform add android@6.4.0 

I have not tested the latest version of the CLI, at the moment I still use the cordova version 7.0.1 with the Android 6.2.3 platform, so I'm not sure that Cordova android 6.4.0 will work with cordor 8, or you will also have to downgrade CLI

+2
source

Add a pedestrian crossing to your project may support version 4.1.1 for Android.

Firstly, ionic cordova platform remove android

Then ionic cordova platform add android@6.2.3

Finally,

 cordova plugin add cordova-plugin-crosswalk-webview 
+1
source

Source: https://habr.com/ru/post/1274647/


All Articles