Issue in building ionic app for android platform


#1

Hi all,

I am a first time user to ionic and i have created a project and when i tried to build i got this error-- Please help me
" C:\Users\Maddy\Desktop\myApp>ionic build android
Running command: “C:\Program Files\nodejs\node.exe” C:\Users\Maddy\Desktop\myApp
\hooks\after_prepare\010_add_platform_class.js C:\Users\Maddy\Desktop\myApp

add to body class: platform-android

ANDROID_HOME=C:\Users\Maddy\AppData\Local\Android\sdk

JAVA_HOME=C:\Program Files\Java\jdk1.8.0_66

Subproject Path: CordovaLib

rm: could not remove file (code EBUSY): C:\Users\Maddy\Desktop\myApp\platforms\a
ndroid\gradle\wrapper/gradle-wrapper.jar

rm: could not remove file (code EBUSY): C:\Users\Maddy\Desktop\myApp\platforms\a
ndroid\gradle\wrapper/gradle-wrapper.jar
rm: could not remove directory (code ENOTEMPTY): C:\Users\Maddy\Desktop\myApp\pl
atforms\android\gradle\wrapper

skipping existing file: gradle-wrapper.jar

Exception in thread "main"
java.lang.RuntimeException: Timeout of 120000 reached waiting for exclusive acce
ss to file: C:\Users\Maddy.gradle\wrapper\dists\gradle-2.14.1-all\53l0mv9mggp9q
5m2ip574m21oh\gradle-2.14.1-all.zip
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAcc
essManager.java:61)
at org.gradle.wrapper.Install.createDist(Install.java:47)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)

Error: cmd: Command failed with exit code 1 Error output:
Exception in thread “main” java.lang.RuntimeException: Timeout of 120000 reached
waiting for exclusive access to file: C:\Users\Maddy.gradle\wrapper\dists\grad
le-2.14.1-all\53l0mv9mggp9q5m2ip574m21oh\gradle-2.14.1-all.zip
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAcc
essManager.java:61)
at org.gradle.wrapper.Install.createDist(Install.java:47)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)

"


#2

The problem here is with permission. Just give read/write permission to C:\Users\Maddy.gradle folder
Thanks


#3

Just remove the gradle-<version>-all.zip.lck file inside /.gradle/wrapper/dists/gradle-<version>-all/<hash key>/ worked for me.