droidperf
raw JSON → 1.0.4 verified Sat Apr 25 auth: no javascript
Android Gradle performance auditor and auto-fixer that scans projects for common build misconfigurations (e.g., disabled configuration cache, parallel execution, or low JVM heap) and applies safe, revertible edits. Version 1.0.4 is the latest stable release; the project follows a monthly release cadence with conservative fixes, transparent diffs via --dry-run, and timestamped backups. Unlike generic Gradle optimization guides, droidperf provides automated audit-to-fix workflows, machine-readable JSON output for CI, and rule-specific enable/disable configuration.
Common errors
error SyntaxError: Unexpected token 'export' ↓
cause Running droidperf with CommonJS require() or Node.js <18.
fix
Use
import droidperf from 'droidperf' and ensure Node.js >=18. error Error: ENOENT: no such file or directory, open '.../gradle.properties' ↓
cause The specified project path does not contain gradle.properties or is not an Android project.
fix
Verify the project path points to an Android project root (where gradle.properties resides).
error Error: Cannot find module 'droidperf' ↓
cause droidperf not installed or not in node_modules.
fix
Install via
npm install droidperf --save-dev and ensure node_modules is present. error TypeError: droidperf is not a function ↓
cause Using default import incorrectly with CommonJS require() in v1.x.
fix
Use
import droidperf from 'droidperf' or switch to named imports like import { runAudit } from 'droidperf'. Warnings
deprecated v0.1.x API (CommonJS, default export as function) is deprecated; upgrade to v1.0.x ESM API. ↓
fix Update imports to ESM style: `import droidperf from 'droidperf'` or `import { runAudit } from 'droidperf'`.
breaking Switched to ESM-only in v1.0.0; removed CommonJS support. ↓
fix Use `import` syntax or enable ESM in your project (e.g., `"type": "module"` in package.json).
gotcha Requires Node.js >=18; older versions will fail with syntax errors. ↓
fix Upgrade Node.js to 18 or later.
gotcha The `--json` flag outputs to stdout; do not mix with human-readable output in the same run. ↓
fix Use `--json` alone for machine-readable output; run separately from normal audit/fix.
gotcha Fixes are applied to `gradle.properties` only; other build files (e.g., build.gradle) are not modified. ↓
fix Manual changes may be needed for settings in build.gradle; droidperf only handles gradle.properties settings.
Install
npm install droidperf yarn add droidperf pnpm add droidperf Imports
- default export wrong
const droidperf = require('droidperf')correctimport droidperf from 'droidperf' - runAudit wrong
const { runAudit } = require('droidperf')correctimport { runAudit } from 'droidperf' - runFix
import { runFix } from 'droidperf'
Quickstart
import { runAudit, runFix } from 'droidperf';
async function main() {
const projectPath = '/path/to/android/project';
// Audit
const auditResult = await runAudit(projectPath);
console.log(auditResult.issues);
// Fix (dry run first)
const dryFixResult = await runFix(projectPath, { dryRun: true });
console.log(dryFixResult.diffs);
// Apply fixes
await runFix(projectPath);
}
main().catch(console.error);