How to install ADB? (OSX)

So I’m following the Corona instructions to install the Android SDK, and it just feels like we’re following completely different instructions:

  • There’s no “install” on OSX. It’s just big folder with \eclipse\ and \tools\ folders. (I moved that into Applications as a guess; is that the “sensible location”?)
     
  • platform-tools is installed by default , according to what the SDK manager tells me. (And despite what Google’s own documentation says, there is no “Android SDK” file to run on OSX. Just “android”
     
  • "adb" doesn’t do anything. In platform-tools, there is an adb object, but running it spawns a terminal window that called “adb; exit;”, displaying help information followed by [PROCESS COMPLETE]  and the end of the usefulness of that terminal window. 
     
  • A path is not added. As you might expect from just moving the SDK into a folder and running the manager, there is no path added. And neither the Corona instructions nor Android instructions offer any idea how one would add a path in OSX so that adb can be called anywhere.
     
  • You can’t actually run the command line as displayed. For one, you can’t just type the name of a command to run it in terminal; adb requires typing “open” first. And if you do that, none of the arguments are allowed.
     
  • ddms does not display most Corona print messages. In desperation, I tried running ddms (also in platform-tools, it’s a not bad little GUI for android debug output) And it will occasionally display a print statement. But in my case it’s only displaying one, across the entire program. 99% do not appear.
     
  • You can’t use adb output anyway without enabling developer mode. I’m not expecting Corona to explain this one but it should be mentioned to at least google how to do it for your device. (In the Note 3, for instance, you need to tap on the build number 7 times, and then enable USB debugging.)

General criticism aside - I’ll help rewrite the page if you’d like - any ideas how to actually get adb working on OSX? (I’m out of ideas.)

I struggled with the same about a year ago. I think your main issue is setting the path. I would google how to set path on osx. Once this is done you open a terminal window and type adb + command text and it should work.

Did you follow these instructions:  http://docs.coronalabs.com/guide/distribution/androidBuild/index.html#debugapp

adb is something you run from the command line.  You shouldn’t need to type “open”.  Launch a terminal window and from the $ prompt, you should be able to just type “adb” to do things.  I would not put them in /Applications as they are not really OS-X applications as much as command line tools.

Now in my case I put my folders off of my home directory:  /Users/rmiracle/adt-bundle-mac-x86_64/sdk/platform-tools and /Users/rmiracle/adt-bundle-mac-x86_64/sdk/tools

Then in your home directory there is a hidden file .bash_profile and you need to modify it to add those two folders to the path.  Here is my .bash_profile

export PATH=${PATH}:/Users/rmiracle/bin:/Users/rmiracle/adt-bundle-mac-x86_64/sdk/platform-tools:/Users/rmiracle/adt-bundle-mac-x86_64/sdk/tools
ANDROID_SDK=~/adt-bundle-mac-x86_64/sdk;export ANDROID_SDK

Now I’m old school so I use vi to edit files on the command line.   But you should be able to do:

edit ~/.bash_profile

and open it with your default text editor.    After your .bash_profile is set, exit the terminal and open a new one.  If it’s working, running “adb” on the command line with no parameters will dump help for adb to the terminal window.

Rob

I did follow those instructions. They are somewhat redundant (the OSX build I grabbed had SDK Tools/Platform Tools) and obviously the ‘sensible location’ part flew over my head, so not really sure how useful it is apart from the link, but thank you nonetheless. That being said:

  1. AFAIK there is no information in either the Corona Link to Android link as to creating this specific .bash_profile. Looking just now there is some half answers but nothing concrete on a general google search.
     
  2. If you do *not* have a path setup, you cannot run adb directly. For example, if you manually change to the platform-tools folder (easy enough, using any mild combo of cd and ls) you still cannot just type adb. You *must* type open adb. This is easily demonstrable if you clear your .bash_profile. (But doing so means no command options, at least not without typing some other magic I’m not aware of.)
     
  3. (Just a tip, but if you have Android SDK in the applications folder, and you want to move it elsewhere, you must hold Command while doing so.)

Enabling the path as you suggest makes everything work (hurray!) But I would strongly suggest the following changes to the Corona Guide:

  • Add a small section on creating the .bash_profile. This is completely undocumented and, as it turns out, required for the entire concept to work.
  • Link to the Tutorial “Basic Debugging” from within the Debug section of the guide. The guide only suggests to run Logcat, which, if ddms is any indication, is an overwhelming pile of nonsense. The guide really needs to either have the specific log cat line or a link to the Basic Debugging tutorial to solve this.
  • Specify moving the SDK to the user folder. A small gesture, but would help clear a lot of confusion *and* ensure that following your .bash_profile creation steps goes smoothly.

Cheers!

?!?!?

Alright, now I’m really stuck.

Reopened my Mac. The bash profile is still in place, but typing ‘adb’ in terminal gets a ‘command not found’ message. So I’m back where I’m started.  

  1. Restarted OSX (no effect)
  2. Blind loaded .bash_profile (it’s still there + fully filled out)
  3. Tried ‘. .bash_profile’ as a method to reload (no effect)
  4. Tried running from platform-tools (still get ‘command not found’ as I described before)
  5. ‘open adb’ from platform-tools will load the help message, but that’s it.

Ideas?

Alright, solved through much googling.

  1. You must type / before any directory. (argh! so simple!)

  2. If you want to run adb without it, use ./adb (really!)

Actually:   ./adb

only works if you are in the folder with the adb executable.  The . means my current directory, the slash the divider and the verb after the / is the file to run.

You can do:   echo $PATH 

and make sure the path to your android tools is really being set.  I get this when I run that command:

robs-mbp:~ rmiracle$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/rmiracle/bin:/Users/rmiracle/adt-bundle-mac-x86_64/sdk/platform-tools:/Users/rmiracle/adt-bundle-mac-x86_64/sdk/tools

Of course my directory is /Users/rmiracle   your’s likely is different.  I put my files in /Users/rmiracle/adt-bundle-mac-x86_64/sdk   you may have put yours somewhere else. 

If the folder where the adb file lives is in that path and there is no other adb in the way (i.e. in one of the directories proceeding it), and the adb file has execute permissions, then you won’t need the ./ in front of it.

You can use the command:   which adb

to show you the path it’s actually finding adb in.  Then you can do:    ls -l which adb

which should output something similar to:
 

-rwxr-xr-x@ 1 rmiracle  staff  1270784 Jul 25  2013 /Users/rmiracle/adt-bundle-mac-x86_64/sdk/platform-tools/adb

If there are 3 'x’s you’re in good shape.

Rob

Yeah, I used echo as well, though the error was extremely hard to spot because there are no line breaks or formatting in .bash_profile, and much of the paths are similar if not identical.

‘which’, by the way, does not work in the directory where the target is found.

which should find it if it’s found anywhere in the path.

I struggled with the same about a year ago. I think your main issue is setting the path. I would google how to set path on osx. Once this is done you open a terminal window and type adb + command text and it should work.

Did you follow these instructions:  http://docs.coronalabs.com/guide/distribution/androidBuild/index.html#debugapp

adb is something you run from the command line.  You shouldn’t need to type “open”.  Launch a terminal window and from the $ prompt, you should be able to just type “adb” to do things.  I would not put them in /Applications as they are not really OS-X applications as much as command line tools.

Now in my case I put my folders off of my home directory:  /Users/rmiracle/adt-bundle-mac-x86_64/sdk/platform-tools and /Users/rmiracle/adt-bundle-mac-x86_64/sdk/tools

Then in your home directory there is a hidden file .bash_profile and you need to modify it to add those two folders to the path.  Here is my .bash_profile

export PATH=${PATH}:/Users/rmiracle/bin:/Users/rmiracle/adt-bundle-mac-x86_64/sdk/platform-tools:/Users/rmiracle/adt-bundle-mac-x86_64/sdk/tools
ANDROID_SDK=~/adt-bundle-mac-x86_64/sdk;export ANDROID_SDK

Now I’m old school so I use vi to edit files on the command line.   But you should be able to do:

edit ~/.bash_profile

and open it with your default text editor.    After your .bash_profile is set, exit the terminal and open a new one.  If it’s working, running “adb” on the command line with no parameters will dump help for adb to the terminal window.

Rob

I did follow those instructions. They are somewhat redundant (the OSX build I grabbed had SDK Tools/Platform Tools) and obviously the ‘sensible location’ part flew over my head, so not really sure how useful it is apart from the link, but thank you nonetheless. That being said:

  1. AFAIK there is no information in either the Corona Link to Android link as to creating this specific .bash_profile. Looking just now there is some half answers but nothing concrete on a general google search.
     
  2. If you do *not* have a path setup, you cannot run adb directly. For example, if you manually change to the platform-tools folder (easy enough, using any mild combo of cd and ls) you still cannot just type adb. You *must* type open adb. This is easily demonstrable if you clear your .bash_profile. (But doing so means no command options, at least not without typing some other magic I’m not aware of.)
     
  3. (Just a tip, but if you have Android SDK in the applications folder, and you want to move it elsewhere, you must hold Command while doing so.)

Enabling the path as you suggest makes everything work (hurray!) But I would strongly suggest the following changes to the Corona Guide:

  • Add a small section on creating the .bash_profile. This is completely undocumented and, as it turns out, required for the entire concept to work.
  • Link to the Tutorial “Basic Debugging” from within the Debug section of the guide. The guide only suggests to run Logcat, which, if ddms is any indication, is an overwhelming pile of nonsense. The guide really needs to either have the specific log cat line or a link to the Basic Debugging tutorial to solve this.
  • Specify moving the SDK to the user folder. A small gesture, but would help clear a lot of confusion *and* ensure that following your .bash_profile creation steps goes smoothly.

Cheers!

?!?!?

Alright, now I’m really stuck.

Reopened my Mac. The bash profile is still in place, but typing ‘adb’ in terminal gets a ‘command not found’ message. So I’m back where I’m started.  

  1. Restarted OSX (no effect)
  2. Blind loaded .bash_profile (it’s still there + fully filled out)
  3. Tried ‘. .bash_profile’ as a method to reload (no effect)
  4. Tried running from platform-tools (still get ‘command not found’ as I described before)
  5. ‘open adb’ from platform-tools will load the help message, but that’s it.

Ideas?

Alright, solved through much googling.

  1. You must type / before any directory. (argh! so simple!)

  2. If you want to run adb without it, use ./adb (really!)

Actually:   ./adb

only works if you are in the folder with the adb executable.  The . means my current directory, the slash the divider and the verb after the / is the file to run.

You can do:   echo $PATH 

and make sure the path to your android tools is really being set.  I get this when I run that command:

robs-mbp:~ rmiracle$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/rmiracle/bin:/Users/rmiracle/adt-bundle-mac-x86_64/sdk/platform-tools:/Users/rmiracle/adt-bundle-mac-x86_64/sdk/tools

Of course my directory is /Users/rmiracle   your’s likely is different.  I put my files in /Users/rmiracle/adt-bundle-mac-x86_64/sdk   you may have put yours somewhere else. 

If the folder where the adb file lives is in that path and there is no other adb in the way (i.e. in one of the directories proceeding it), and the adb file has execute permissions, then you won’t need the ./ in front of it.

You can use the command:   which adb

to show you the path it’s actually finding adb in.  Then you can do:    ls -l which adb

which should output something similar to:
 

-rwxr-xr-x@ 1 rmiracle  staff  1270784 Jul 25  2013 /Users/rmiracle/adt-bundle-mac-x86_64/sdk/platform-tools/adb

If there are 3 'x’s you’re in good shape.

Rob

Yeah, I used echo as well, though the error was extremely hard to spot because there are no line breaks or formatting in .bash_profile, and much of the paths are similar if not identical.

‘which’, by the way, does not work in the directory where the target is found.

which should find it if it’s found anywhere in the path.