capacitor icon indicating copy to clipboard operation
capacitor copied to clipboard

[Bug]: Can't build android app

Open billypon opened this issue 2 weeks ago • 1 comments

Capacitor Version

💊 Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 8.0.0 @capacitor/core: 8.0.0 @capacitor/android: 8.0.0 @capacitor/ios: 8.0.0

Installed Dependencies:

@capacitor/ios: not installed @capacitor/cli: 8.0.0 @capacitor/android: 8.0.0 @capacitor/core: 8.0.0

Other API Details


Platforms Affected

  • [ ] iOS
  • [x] Android
  • [ ] Web

Current Behavior

FAILURE: Build failed with an exception.

  • Where: Settings file 'android/settings.gradle' line: 5

  • What went wrong: A problem occurred evaluating settings 'android'.

Could not read script 'android/capacitor.settings.gradle' as it does not exist.

Expected Behavior

Build android app successfully

Project Reproduction

https://github.com/billypon/my-app

Additional Information

Here is my procedure:

npm init @capacitor/app
cd my-app
pnpm i @capacitor/android
node_modules/.bin/cap add android
node_modules/.bin/cap build android

billypon avatar Dec 10 '25 03:12 billypon

Hey @billypon, when running node_modules/.bin/cap add android, you should get a "[warn] sync could not run--missing dist directory."

This is what causes node_modules/.bin/cap build android to fail. Run pnpm run build which will generate the dist folder, and then run node_modules/.bin/cap sync android.

After which node_modules/.bin/cap build android should no longer fail with that error (you may still get an error about missing keystore to sign the apk / app bundle; if you want to run it in an emulator or physical device you can use cap run android instead).

So the correct order of commands would be

npm init @capacitor/app
cd my-app
pnpm i @capacitor/android
pnpm run build
node_modules/.bin/cap add android
node_modules/.bin/cap build android

Hope this helps!

OS-pedrogustavobilro avatar Dec 10 '25 10:12 OS-pedrogustavobilro

@OS-pedrogustavobilro Wow, now it works! Thanks for you help.

billypon avatar Dec 11 '25 02:12 billypon