Ionic android build error

I am trying to build android for my ionic app and i get this error

C:\Windows\System32\Myapp>ionic build android
Native thread-sleep not available.
This will result in much slower performance, but it will still work.
You should re-install spawn-sync or upgrade to the lastest version of node if po
ssible.
Check C:\Users\Hari\AppData\Roaming\nvm\v0.10.38\node_modules\ionic\node_modules
\ionic-app-lib\node_modules\cross-spawn\node_modules\spawn-sync\error.log for mo
re details
Running command: “C:\Program Files\nodejs\node.exe” C:\Windows\System32\Myapp\ho
oks\after_prepare\010_add_platform_class.js C:\Windows\System32\Myapp
add to body class: platform-android
Running command: cmd “/s /c “C:\Windows\System32\Myapp\platforms\android\cordova
\build.bat --debug””
ANDROID_HOME=C:\adt-bundle-windows-x86-20130219\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_71
Running: C:\Windows\System32\Myapp\platforms\android\gradlew cdvBuildDebug -b C:
\Windows\System32\Myapp\platforms\android\build.gradle -Dorg.gradle.daemon=true
:preBuild
:compileDebugNdk UP-TO-DATE
:preDebugBuild
:checkDebugManifest
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:preBuild
:CordovaLib:preDebugBuild
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:processDebugResourcesERROR: asset directory ‘C:\Windows\System32\Mya
pp\platforms\android\CordovaLib\build\intermediates\bundles\debug\assets’ does n
ot exist FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:CordovaLib:processDebugResources’.

com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\adt-bundle-windows-x86-20130219\sdk\build-tools\23.0.1\aapt.exe packa
ge -f --no-crunch -I C:\adt-bundle-windows-x86-20130219\sdk\platforms\android-22
\android.jar -M C:\Windows\System32\Myapp\platforms\android\CordovaLib\build\int
ermediates\bundles\debug\AndroidManifest.xml -S C:\Windows\System32\Myapp\platfo
rms\android\CordovaLib\build\intermediates\bundles\debug\res -A C:\Windows\Syste
m32\Myapp\platforms\android\CordovaLib\build\intermediates\bundles\debug\assets
-m -J C:\Windows\System32\Myapp\platforms\android\CordovaLib\build\generated\sou
rce\r\debug --debug-mode --custom-package org.apache.cordova --non-constant-id -
0 apk --output-text-symbols C:\Windows\System32\Myapp\platforms\android\CordovaL
ib\build\intermediates\bundles\debug
Error Code:
1
Output:
ERROR: asset directory ‘C:\Windows\System32\Myapp\platforms\android\Cord
ovaLib\build\intermediates\bundles\debug\assets’ does not exist

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

BUILD FAILED

Total time: 5.423 secs

C:\Windows\System32\Myapp\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s /c “C:\Windows\System32\Myapp\platfo
rms\android\gradlew cdvBuildDebug -b C:\Windows\System32\Myapp\platforms\android
\build.gradle -Dorg.gradle.daemon=true”
ERROR building one of the platforms: Error: cmd: Command failed with exit code 8

You may not have the required environment or OS to build this project
Error: cmd: Command failed with exit code 8
at ChildProcess.whenDone (C:\Users\Hari\AppData\Roaming\npm\node_modules\cor
dova\node_modules\cordova-lib\src\cordova\superspawn.js:139:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:766:16)
at Process.ChildProcess._handle.onexit (child_process.js:833:5)

pls help me.

Did you set ANDROID_HOME in your path?!
I fixed this problem although my ANDROID_HOME was set in my path, by uninstalling npm,cordova and ionic and then install them again. for install I follow these step:
1.install npm
2.install cordova
3.install ionic.

the ANDROID_PATH is C:\Users\Hari\AppData\Local\Android\sdk
but still i get the same error

make sure it is ANDROID_HOME=C:\Users\Hari\AppData\Local\Android\sdk not ANDROID_PATH.
also set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools to your PATH. try to restart your computer so the path will be updated.
this might help you to make sure everything is set correctly.

thank you for your reply. I tried to build the app through ionic lab and it worked.

Thank you :smile:

I still face issue

BUILD FAILED
C:\Program Files\Android\Sdk\tools\ant\build.xml:716: The following error occurr
ed while executing this line:
C:\Program Files\Android\Sdk\tools\ant\build.xml:730: Compile failed; see the co
mpiler error output for details.

Total time: 2 seconds

F:\Verifast\Ionic\Teller\src\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s,/c,ant,debug,-f,F:\Verifast\Ionic\Te
ller\src\platforms\android\build.xml,-Dout.dir=ant-build,-Dgen.absolute.dir=ant-
gen
ERROR building one of the platforms: Error: cmd: Command failed with exit code 1

You may not have the required environment or OS to build this project
Error: cmd: Command failed with exit code 1

Please help