0

I recently wanted to try out ionic and specifically develop android apps. I was able to set everything up using the ionic tutorial and run via localhost. I want to be able to do the same using the android emulator but have been unsuccessful. I have searched and tried everything but I am still not sure how to resolve the error below. All the code is from the ionic getting started page with their project called todo. If anyone could help me with this. it would be much appreciated. I am using Ubuntu. The following is what my terminal gives when I run "ionic build android"

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':CordovaLib:processDebugResources'.
> com.android.ide.common.process.ProcessException:  
org.gradle.process.internal.ExecException:
Process 'command '/home/myname/Android/Sdk/build-tools/24.0.0/aapt''    
finished with non-zero exit value 127

* 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: 37.93 secs
Error: Error code 1 for command: /home/myname/todo/platforms/android 
/gradlew with args: cdvBuildDebug,-b,/home/myname/todo/platforms
/android/build.gradle,-Dorg.gradle.daemon=true,
Pandroid.useDeprecatedNdk=true

Edit 1: I ran the following command suggested below: ./gradlew assembleDebug -info and I get the following error:

:CordovaLib:processDebugResources
Executing task ':CordovaLib:processDebugResources' (up-to-datecheck      
took 0.058 secs) due to:
No history is available.
All input files are considered out-of-date for incremental task
':CordovaLib:processDebugResources'.
Starting process 'command '/home/myname/Android/Sdk/build-tools/24.0.0
/aapt''. Working directory: /home/myname/todo/platforms/android 
/CordovaLib Command: /home/myname/Android/Sdk/build-tools/24.0.0/aapt 
package -f --no-crunch -I /home/myname/Android/Sdk/platforms/android- 
23/android.jar -M /home/myname/todo/platforms/android/CordovaLib/build
/intermediates/bundles/debug/aapt/AndroidManifest.xml -S /home/myname
/todo/platforms/android/CordovaLib/build/intermediates/bundles/debug/res
-A /home/myname/todo/platforms/android/CordovaLib/build/intermediates
/bundles/debug/assets -m -J /home/myname/todo/platforms/android 
/CordovaLib /build/generated/source/r/debug --debug-mode --custom-
package 
org.apache.cordova --non-constant-id -0 apk --output-text-symbols  
/home/myname/todo/platforms/android/CordovaLib/build/intermediates 
/bundles /debug
Successfully started process 'command '/home/myname/Android/Sdk/build-
tools/24.0.0/aapt''
Unknown source file : /home/myname/Android/Sdk/build-tools/24.0.0/aapt:
1: /home/myname/Android/Sdk/build-tools/24.0.0/aapt: ELF: not
found :CordovaLib:processDebugResources FAILED

From what I see I understand that something is wrong with the aapt file, If I remove it it throws errors, so I am not sure how to edit the aapt file

lolname101
  • 29
  • 1
  • 4
  • Try `ionic platform rm android` followed by a `ionic platform add android` – Chisko Jul 03 '16 at 20:19
  • I tried that, but it doesn't work it still throws the same error – lolname101 Jul 03 '16 at 20:32
  • It appears that you are referencing an unexisting image or something else from the resources folder. – Chisko Jul 03 '16 at 20:35
  • so removing the line of code referencing the image would fix it? – lolname101 Jul 03 '16 at 20:52
  • It should... try and see – Chisko Jul 03 '16 at 20:54
  • and please let me know so I can post it as an answer – Chisko Jul 03 '16 at 21:02
  • Which file am I supposed to modify? I went into the config.xml and removed all the references to things in the resource folder, and I still get the same error – lolname101 Jul 03 '16 at 21:51
  • Questions seeking debugging help (**"why isn't this code working?"**) must include *the desired behavior*, *a specific problem or error* and *the shortest code necessary* to reproduce it **in the question itself**. Questions without **a clear problem statement** are not useful to other readers. See: [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). – Gustavo Morales Jul 04 '16 at 01:21

2 Answers2

1

This could be related to a filename error somewhere in your project. To see where the error in file is,

go to your android folder via terminal, /projectName/platforms/android

Then, execute gradlew assembleDebug --info

It should show in the end which file it is.

-- EDIT

This could be related to Ubuntu incompatibility problems,

As per https://stackoverflow.com/a/27734148/2036808

$ sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 lib32stdc++6
Community
  • 1
  • 1
dariru
  • 501
  • 6
  • 16
1

After hours spent in the same issue, just solved the problem by running some updates:

npm update -g ionic cordova

This information was found at: https://forum.ionicframework.com/t/android-build-failed/32069

José Augustinho
  • 110
  • 1
  • 10