Adam Johns
Adam Johns

Reputation: 36373

Determine Android sdk location from script

I am writing a bash script to automate my Android build process. I need to run

android update project --path /bla/bla

If I didn't want to add the sdk tools directory to my PATH, and I didn't want to pass the script my sdk tools directory, is there a way for the script to determine the location of the sdk, so that it may run the android command?

Upvotes: 1

Views: 283

Answers (1)

Gaurav Fotedar
Gaurav Fotedar

Reputation: 695

Can you be more specific as to what problem are you facing?

Maybe, you could search for the android command in your script and then run it.

This would search your file system ( "/" ) for the android command and store the full path in the variable execute_android

execute_android=`find / -type f -name android`

after this :

$execute_android update project --path /bla/bla

But, this would fail if you have another file named android on your system.

Upvotes: 1

Related Questions