Issues with CORDOVA/ANDROID builds

I use AppFlow to compile HTML5, CSS, and JS files into Android and iOS apps. I do this entirely through the web version, via commit/push and then compiling via the web. Everything was working fine until a few weeks ago when the Android builds stopped compiling. After talking to support, they told me the problem was this:

"Paul LaCaille (Ionic Support)

Thanks for contacting Ionic support!

For some general guidance, I have seen a number of users running into issues with Android builds as a result of JCenter’s permanent sunset on 8/15/2024: JCenter Sunset on August 15th, 2024 | JFrog. With a Capacitor project, you will want to update your build.gradle file to remove jcenter() and replace it with mavenCentral(). You will also need to remove and find alternatives for any plugins that require a dependency only available in JCenter. With a Cordova project, it looks like Cordova Android 10.0.0 drops JCenter, so you will likely need to update to this version, or a more recent version. You will also need to remove and find alternatives for any plugins that require a dependency only available in JCenter."

However, even after removing any plugin accessed via npm, the problem persists, and it’s not possible to compile using Cordova 13—only version 12 is available. iOS builds work fine.

Is anyone else having this kind of difficulty with Cordova?

What’s the build error?

The support message seems to indicate that the problem is the jcenter sunset, but cordova-android 13 doesn’t use jcenter.

cordova-android 13 is not availabe in Ionic AppFlow.
I saw this on some forums, but even specifying version 13 in package.json, it is not available.

About the compilation error, every time I compile, even using the same code, it brings different errors.

Here are today’s bugs

This is from 3 days ago

With a lot of effort, I managed to make a compilable version, but the generated app does not have permission to access the internet (even with directives for this) GitHub - diogenesjup/pesuas at 2cb2952785ab1ebd9201a304ce855839b7f85bb1

Those logs show that the app is trying to download cordova-android@^8.0.0, not 13.

You can use any cordova-android version in Appflow, there is no such thing as an specific version not “being available”, Appflow will download and install whatever you “told” it to download. But depending on what you download it will fail to build, in example cordova-android 13 requires SDK 34 to be available, that’s only available on latest runners, Linux - 2023.10 and Linux - 2024.06.

You have to figure out why the app is downloading cordova-android@^8.0.0 instead of 13, check the config.xml in case the platform is there too, Cordova might give preference to dependencies in the config.xml versus dependencies in package.json.

I don’t think that’s it. In the appFlow itself, when I look at the “Build Stack” spec, it clearly says to use “Cordova CLI
12.0.0”

Even if I add , the compilation error persists. And as I mentioned, until mid-August it compiled without problems. Just for the record, this is my config.xml

<?xml version='1.0' encoding='utf-8'?> Pesuas Prontuário eletronico do Sistema Único de Assistência Social de Benjamin Constant-AM Fabrica de Plugins e Diogenes Junior
<preference name="android-build-tool" value="gradle" />
<preference name="orientation" value="portrait" />
<preference name="target-device" value="handset" />
<preference name="fullscreen" value="false" />
<preference name="webviewbounce" value="true" />
<preference name="prerendered-icon" value="true" />
<preference name="stay-in-webview" value="false" />
<preference name="ios-statusbarstyle" value="black-opaque" />
<preference name="detect-data-types" value="true" />
<preference name="exit-on-suspend" value="false" />
<preference name="disable-cursor" value="false" />
<preference name="android-installLocation" value="auto" />
<preference name="StatusBarBackgroundColor" value="#00940a" />

<preference name="AutoHideSplashScreen" value="true" />
<preference name="SplashScreen" value="none" />
<preference name="ShowSplashScreen" value="false" />

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

<preference name="AndroidXEnabled" value="true" />

<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application/activity[@android:name='MainActivity']">
    <activity android:exported="true" />
</edit-config>

<plugin name="cordova-plugin-androidx" />
<plugin name="cordova-plugin-androidx-adapter" />
<!--<plugin name="cordova-plugin-local-notification" />-->
<plugin name="cordova-plugin-android-permissions" />
<plugin name="cordova-plugin-inappbrowser" />
<plugin name="cordova-plugin-statusbar" />
<plugin name="cordova-plugin-ionic-webview" />


<preference name="WKWebViewOnly" value="true" />
<feature name="CDVWKWebViewEngine">
    <param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
<preference name="Scheme" value="https" />
<preference name="ScrollEnabled" value="true" />

<platform name="android">

    <engine name="android" spec="^12.0.0" />
    <preference name="android-minSdkVersion" value="29" />
    <preference name="android-targetSdkVersion" value="34" />
    <preference name="android-compileSdkVersion" value="34" />

    <icon density="ldpi" height="36" src="www/assets/images/icones/36.png" width="36" />
    <icon density="ldpi" height="40" src="www/assets/images/icones/40.png" width="40" />
    <icon density="mdpi" height="57" src="www/assets/images/icones/57.png" width="57" />
    <icon density="mdpi" height="64" src="www/assets/images/icones/64.png" width="64" />
    <icon density="hdpi" height="72" src="www/assets/images/icones/72.png" width="72" />
    <icon density="xhdpi" height="114" src="www/assets/images/icones/114.png" width="114" />
    <icon density="xhdpi" height="120" src="www/assets/images/icones/120.png" width="120" />
    <icon density="xxhdpi" height="144" src="www/assets/images/icones/144.png" width="144" />
    <icon density="xxhdpi" height="152" src="www/assets/images/icones/152.png" width="152" />
    <icon density="xxhdpi" height="173" src="www/assets/images/icones/173.png" width="173" />
    <icon density="xhdpi" height="96" src="www/assets/images/icones/96.png" width="96" />
    <icon density="xxhdpi" height="180" src="www/assets/images/icones/180.png" width="180" />
    <icon density="xxxhdpi" height="192" src="www/assets/images/icones/192.png" width="192" />
    <icon density="xxxhdpi" height="225" src="www/assets/images/icones/225.png" width="225" />
    <icon density="xxxhdpi" height="320" src="www/assets/images/icones/320.png" width="320" />
    <icon density="xxxhdpi" height="512" src="www/assets/images/icones/512.png" width="512" />
    <icon density="xxxhdpi" height="768" src="www/assets/images/icones/768.png" width="768" />
    <icon density="xxxhdpi" height="960" src="www/assets/images/icones/960.png" width="960" />
    <icon density="xxxhdpi" height="1024" src="www/assets/images/icones/1024x1024.png" width="1024" />

    <plugin name="cordova-plugin-whitelist" version="1.3.4"  />
    <access origin="*" />
    <allow-navigation href="*" />
    <allow-intent href="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />

</platform>
<platform name="ios">
    <icon density="ldpi" height="36" src="www/assets/images/icones/36.png" width="36" />
    <icon density="ldpi" height="40" src="www/assets/images/icones/40.png" width="40" />
    <icon density="mdpi" height="57" src="www/assets/images/icones/57.png" width="57" />
    <icon density="mdpi" height="64" src="www/assets/images/icones/64.png" width="64" />
    <icon density="hdpi" height="72" src="www/assets/images/icones/72.png" width="72" />
    <icon density="xhdpi" height="114" src="www/assets/images/icones/114.png" width="114" />
    <icon density="xhdpi" height="120" src="www/assets/images/icones/120.png" width="120" />
    <icon density="xxhdpi" height="144" src="www/assets/images/icones/144.png" width="144" />
    <icon density="xxhdpi" height="152" src="www/assets/images/icones/152.png" width="152" />
    <icon density="xxhdpi" height="173" src="www/assets/images/icones/173.png" width="173" />
    <icon density="xhdpi" height="96" src="www/assets/images/icones/96.png" width="96" />
    <icon density="xxhdpi" height="180" src="www/assets/images/icones/180.png" width="180" />
    <icon density="xxxhdpi" height="192" src="www/assets/images/icones/192.png" width="192" />
    <icon density="xxxhdpi" height="225" src="www/assets/images/icones/225.png" width="225" />
    <icon density="xxxhdpi" height="320" src="www/assets/images/icones/320.png" width="320" />
    <icon density="xxxhdpi" height="512" src="www/assets/images/icones/512.png" width="512" />
    <icon density="xxxhdpi" height="768" src="www/assets/images/icones/768.png" width="768" />
    <icon density="xxxhdpi" height="960" src="www/assets/images/icones/960.png" width="960" />
    <icon density="xxxhdpi" height="1024" src="www/assets/images/icones/1024x1024.png" width="1024" />
    <icon height="20" src="www/assets/images/icones/20.png" width="20" />
    <icon height="60" src="www/assets/images/icones/60.png" width="60" />
    <icon height="29" src="www/assets/images/icones/29.png" width="29" />
    <icon height="58" src="www/assets/images/icones/58.png" width="58" />
    <icon height="87" src="www/assets/images/icones/87.png" width="87" />
    <icon height="76" src="www/assets/images/icones/76.png" width="76" />
    <icon height="152" src="www/assets/images/icones/152.png" width="152" />
    <icon height="167" src="www/assets/images/icones/167.png" width="167" />
</platform>

Cordova CLI is one thing, cordova-android another.

Latest Cordova CLI (cordova package on npm) is 12, latest cordova-android is 13.

Appflow will use Cordova CLI 12, but for cordova-android is up to you which version to use.

The engine tag (<engine name="android" spec="^12.0.0" />) doesn’t work inside platform tag, move it outside.

It was just a test, even changing the engine location, or simply not adding it, the compilation does not complete. Even if I remove all plugins, and literally put a completely blank index, the compilation does not work.

But did the error change? is it still trying to use cordova-android 8 like in the 2 error logs you shared?

Still with the same error.

I forked your repository and after removing the gradle plugins and a few other things was able to build fine on appflow, I sent a PR to your repository with the changes.

1 Like

Great interventions, it really worked after I applied the PR changes