Problem on ionic build android (not $PATH related)


#1

Hi !

I’m kinda new to Ionic but been developing with AngularJS for a while.
Everything been working superb on localhost, but then I tried to build:

I added the platform:
ionic platform add android ok

Then tried to build and got the following error:

ionic build android

TRANSLATION: “Arquivo ou diretório não encontrado” means File or directory not found, but they do! Can’t count how many times I checked.

I Created a brand new app and tried to build. Same error.

Can you help me please? Thanks in advance :smile:


#2

Hi,
Try this perhaps it work
Enter with root user

$ sudo su

Then add android platform

# cordova platform add android

if it’s not work try to check your permission

Then make sure u change permission of platforms directory

# chmod -R 775 /ionic-project/platforms

After that try to prepare and compile your project

# cordova prepare android
# cordova compile android

To try it using Android emulator or Genymotion, use this

# cordova run android

#3

Hi @donny thank you for your time :smile:

I followed your steps, but got stuck on compile, same error, no directory found, now as root.

Heres another pic of the error:

Any other suggestion?


#4

Hm… that was unclear information
"No Directory Found" it’s for platforms directory or android directory (inside platforms directory) ?

Ensure android directory has created inside platforms directory, if it’s not exist try to change permission of platforms directory to 777/775. then add platform again.
if it’s still failed
try this one

$ sudo su
# cordova platform rm android

remove “android.json” in plugins directory

# rm /plugins/android.json

then add android platform

# cordova platform add android

then prepare and compile your project

# cordova prepare android
# cordova compile android

if still error, try to copy your result and post it here

Perhaps it works :wink:


#5

Yeah, it’s kinda unclear since he talk about 2 directories in the same sentence, hehe but I checked and both exists and I put 777 permissios in both directories :cry:

After I removed the platform, the file android.json wasn’t there anymore, so I didn’t need to delete.

The full error report is on gist (got the same error):
https://gist.github.com/rcbytes/5e224deeac63a9bc07f8

Didn’t know if it’d be formatted corretly by this editor, thank ya again @donny


#6

Hm… actualy after you deleted “android.json” when you ran this command

$ cordova prepare android

it will create android.json again :wink:

what i can see in your result, i think it’s error because your android sdk "/home/gama/applications/android-sdk-linux/"
make sure you have latest update and do not forget to install ant

# brew update
# brew install ant

Here your missing directory "/home/gama/applications/android-sdk-linux/build-tools/19.1.0/aapt"
by the way i am using latest version, try to install the latest version first. open up your android sdk manager and install latest build-tools or just update.

# android

as you can see, just select which one of those Android SDK Build-Tools
after you install it, check your “build-tools” directory

it’s should be like those screen shot

Perhaps it’s work :wink: