Bug Report
Problem
When I run a cordova build on a fresh git cloned project, after npm install, the following error occurs:
Failed to install 'cordova-plugin-statusbar':
Error: C:\path-to-app\platforms\android\cdv-gradle-config.json: ENOENT: no such file or directory,
open 'C:\path-to-app\platforms\android\cdv-gradle-config.json'
My workaround, is adding a pre build script which adds the platform again:
if (!existsSync('platforms/android/android.json')) {
const cordovaAndroidVersion = devDependencies['cordova-android'];
execSync(`cordova platform add android@${cordovaAndroidVersion}`, { stdio: 'inherit' });
}
But then, sometimes the following error appears:
CordovaError: Platform android already added.
at C:\path-to-app\node_modules\cordova-lib\src\cordova\platform\addHelper.js:120:35
Command or Code
cordova build android --release
I think we should ensure that the platform incl. folder structure exists on npm i or cordova build. Because it's already defined in package.json.
Environment, Platform, Device
Windows 11, Node 20.14, cordova-android 13
Checklist