apache/cordova-android · error · CordovaError
Malformed BoM platform: ${p}
Error message
Malformed BoM platform: ${p} What it means
While regenerating app/build.gradle, ProjectBuilder collects every `cordova.system.library.N=platform('...')` line from project.properties into bomPlatforms and requires each captured value to match /:.*:/ - i.e. full gradle coordinates group:name:version - before emitting `implementation platform("...")`. Thrown when the platform(...) value has fewer than two colons.
Source
Thrown at lib/builders/ProjectBuilder.js:245
}
};
subProjects.forEach(function (p) {
events.emit('log', 'Subproject Path: ' + p);
const libName = p.replace(/[/\\]/g, ':').replace(projectName + '-', '');
if (libName !== 'app') {
depsList += ' implementation(project(path: ":' + libName + '"))';
insertExclude(p);
}
});
// For why we do this mapping: https://issues.apache.org/jira/browse/CB-8390
const SYSTEM_LIBRARY_MAPPINGS = [
[/^\/?extras\/android\/support\/(.*)$/, 'com.android.support:support-$1:+'],
[/^\/?google\/google_play_services\/libproject\/google-play-services_lib\/?$/, 'com.google.android.gms:play-services:+']
];
propertiesObj.bomPlatforms.forEach(function (p) {
if (!/:.*:/.exec(p)) {
throw new CordovaError('Malformed BoM platform: ' + p);
}
// Add bom platform
depsList += ' implementation platform("' + p + '")\n';
});
propertiesObj.systemLibs.forEach(function (p) {
let mavenRef;
// It's already in gradle form if it has two ':'s
if (/:.*:/.exec(p)) {
mavenRef = p;
} else if (/:.*/.exec(p)) {
// Support BoM imports
mavenRef = p;
events.emit('warn', 'Library expects a BoM package: ' + p);
} else {
for (let i = 0; i < SYSTEM_LIBRARY_MAPPINGS.length; ++i) {
const pair = SYSTEM_LIBRARY_MAPPINGS[i];View on GitHub (pinned to 7c1e190064)
Solutions
- Fix the entry to full Maven coordinates: `cordova.system.library.4=platform('com.google.firebase:firebase-bom:32.7.0')`.
- If you meant a plain dependency, drop the platform(...) wrapper and use bare coordinates `group:name:version` (those go through systemLibs instead).
- Remove the offending numbered line entirely if the dependency is unneeded.
- If a plugin injected the bad line, patch the plugin or pin a fixed version, then re-add the platform so project.properties is regenerated.
Example fix
# before (platforms/android/project.properties)
cordova.system.library.4=platform('com.google.firebase:firebase-bom')
# after
cordova.system.library.4=platform('com.google.firebase:firebase-bom:32.7.0') Defensive patterns
Strategy: validation
Validate before calling
const props = fs.readFileSync('platforms/android/project.properties', 'utf8');
for (const m of props.matchAll(/^\s*cordova\.system\.library\.\d+=platform\(['"]?([^'")]+)['"]?\)/gm)) {
if (!/:.+:.+/.test(m[1])) {
throw new Error(`BoM entry '${m[0]}' needs full group:name:version coordinates`);
}
} Type guard
const isGradleCoordinate = (s) => /^[^:]+:[^:]+:.+$/.test(s); // group:name:version
Try / catch
try {
await androidApi.build(opts);
} catch (e) {
if (/Malformed BoM platform/.test(e.message)) {
// extract the printed value, point at the matching cordova.system.library.N line in project.properties
}
throw e;
} Prevention
- Always write BoM entries as platform('group:name:version') with the version included.
- When authoring plugins, run a scratch `cordova plugin add` + build in CI to catch bad <lib> declarations before release.
- Re-generate the platform after fixing plugin declarations so project.properties is rewritten.
When it happens
Trigger: A plugin (via its gradle/library declarations) or a hand-edited platforms/android/project.properties line such as `cordova.system.library.4=platform('firebase-bom')` or `platform('com.google.firebase:firebase-bom')` - anything without group:name:version. Happens during build prep (prepEnv writes app/build.gradle).
Common situations: Third-party plugin injecting a BoM without full Maven coordinates; copy-paste from docs that dropped the version segment; manual edits to project.properties after a platform regenerate.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Unsupported system library (does not work with gradle): ${p}
- Plugin can't handle uri: ${uri}
- Invalid plugin ID in URI: ${uri}
- ${filePath}: Missing key required "${key}"
- No installed build tools found. Please install the Android b
AI-assisted analysis of apache/cordova-android@7c1e190064 (2026-08-22).
Data as JSON: /api/errors/6d850d6bd7d2851f.
Report an issue: GitHub.