Can't build Android

I started a new project.

I ran cordova platform add android

Everything good so far

I ran ionic cordova build android

Got a complaint for missing @ionic/app-scripts

I ran npm install @ionic/app-scripts@latest --save-dev

Ran ionic cordova build android again

Got a complaint for missing typescript

I ran npm install typescript --save-dev

Then I ran ionic cordova build android once more and got…

ANDROID_HOME=C:\Users\Me\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\java\jdk1.8.0_77
studio
Starting a Gradle Daemon, 2 incompatible and 1 stopped Daemons could not b
e reused, use --status for details

FAILURE: Build failed with an exception.

* What went wrong:
Could not open cp_settings remapped class cache for 8dnxmf3hjzwno8j1dqwy42
sta (C:\Users\Me\.gradle\caches\4.1\scripts-remapped\settings_b42xjgmre82g
pyxhdivj5svoj\8dnxmf3hjzwno8j1dqwy42sta\cp_settings4dada6424967ba8dfea75e8
1c8880f7f).

> Could not open cp_settings generic class cache for settings file 'C:\Use
rs\Me\Desktop\WebApps\app\platforms\android\settings.gradle' (C:\Users\Me\
.gradle\caches\4.1\scripts\8dnxmf3hjzwno8j1dqwy42sta\cp_settings\cp_settin
gs4dada6424967ba8dfea75e81c8880f7f).

> java.io.FileNotFoundException: C:\Users\Me\.gradle\caches\4.1\scripts\8d
nxmf3hjzwno8j1dqwy42sta\cp_settings\cp_settings4dada6424967ba8dfea75e81c88
80f7f\cache.properties (The system cannot find the file specified)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --
debug option to get more log output.


* Get more help at https://help.gradle.org

BUILD FAILED in 46s
(node:6920) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: cmd: Command failed with exit code 1
(node:6920) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the
 Node.js process with a non-zero exit code.
[ERROR] An error occurred while running cordova run android (exit code 1).

Removing the \cache file from my \.gradle directory did the trick.

1 Like