Linux Lite Forums

Software - Support => Tutorials => Topic started by: AndyOpie150 on June 08, 2014, 07:30:44 PM

Title: How to setup the Android SDK globally
Post by: AndyOpie150 on June 08, 2014, 07:30:44 PM
This is not my work really, but a compilation of all the info I had to find by browsing and asking in forums.

After you have installed the Android SDK with the tools and platform tools folder added then you will need to do all this (here is a link to a mini SDK that will work with most anything: http://androidforums.com/faqs/443072-adb-guide-updated-2013-05-21-a.html#post5389081 (http://androidforums.com/faqs/443072-adb-guide-updated-2013-05-21-a.html#post5389081) ):

Install jdk (if not already installed on your machine):
Code: [Select]
sudo apt-get install openjdk-6-jdk
I used the one below instead:
http://www.webupd8.org/2012/11/oracle-sun-java-6-installer-available.html
For actuall Java6 jdk instead of the openjdk-6. After installing the Oracle java6, while in that same terminal, type in:
Code: [Select]
sudo apt-get install oracle-java6-set-default


Install gedit: Go to software center and type in "gedit" into search box.


If Linux distro is a 64bit distro then you need to open a terminal and type in this:
Code: [Select]
sudo apt-get install ia32-libs
If not, adb wil not work.


Put the Linux_SDK folder in your home folder. Change name to just sdk. Make sure all .exe's have the
box checked in the permissions window.


Now plug in your phone into a usb port, open up a command line interface (terminal) and type in:
Code: [Select]
lsusb
This should kick out a list of plugged in devices. Most likely the last one is your phone. If you can't figure out which one it is unplug your phone and type in the same code. The one thats missing is your phone.
On that same line, there is an ID number in this format...xxxx:xxxx. Write that number down for
reference.


Go to /etc/udev/rules.d and look to see which file is the android.rules file. Should be the 51-android.rules file, if not, try looking in 99-android.rules.
Then open up a terminal and type in:
Code: [Select]
sudo gedit /etc/udev/rules.d/51-android.rules (or whatever the exact name of the android.rules file)
If no android.rules file then just type in the above command which will make the 51-android.rules file and put it in the proper place.
When the rules open, go to the end and copy/paste the following:
Code: [Select]
Code:
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", SYMLINK+="android_adb", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTRS{idVendor}=="####:####", SYMLINK+="android_adb", MODE="0666" GROUP="plugdev"TEST=="/var/run/ConsoleKit/database", \RUN+="udev-acl --action=$env{action} --device=$env{DEVNAME}"
Now, replace the ####:#### in the above string of text with the number you wrote down a few steps
ago. Then save and exit.
Note: For even more info on the 51-android.rules file go here: http://www.joescat.com/linux/android_rules.html (http://www.joescat.com/linux/android_rules.html)


Another command:
Code: [Select]
sudo service udev restart


Now check to see if you're good:
cd SDK/platform-tools
Code: [Select]
./adb devices


Should get the device s/n now. If not, exit, restart machine then open up terminal and retry the
above 2 commands. If all is well and you want to be able to adb/fastboot globally, you'll need to
edit the bashrc like this:
Code: [Select]
sudo gedit ~/.bashrc
When the file window pops up, copy/paste the following at the end of the existing text, then save
and exit.
Code: [Select]
# Android tools
export PATH=${PATH}:~/sdk/tools
export PATH=${PATH}:~/sdk/platform-tools


Double check by going to home folder and hitting Ctrl + h.
If the .bashrc is locked then you will need to open up a terminal and type in this:
Code: [Select]
sudo chown -R (user name):(user name) .bashrc


In some linux distro's this is not enough. If all that didn't work then go to the ~/sdk/platform-tools folder and make a link to the adb.exe by using the right click option (this will probably name it "link to adb"). Move it to the ~/ folder and rename to just adb.
Now open up a terminal and type in:
Code: [Select]
sudo mv ~/adb /usr/bin

Note: The same needs to be done with fastboot.



Now unplug phone, restart machine. Once fired back up, plug phone back in and from any location run:
Code: [Select]
adb devices

If all went well, it'll output your s/n as before but without the ./ prefix.


You can now fire up a terminal anywhere and give your phone fastboot commands and use the Android
Debug Bridge a little easier.



For more info on ADB and Fastboot commands go here:
http://forum.xda-developers.com/showthread.php?t=2225405

For way more info on Fastboot commands go here:
http://forum.xda-developers.com/showthread.php?t=2277112

Updated 06/09/2014 at 4:00pm Eastern Time Zone
Title: Re: How to setup the Android SDK globally
Post by: itsmix on September 20, 2014, 06:03:47 AM
"If Linux distro is a 64bit distro then you need to open a terminal and type in this:
Code: [Select]
sudo apt-get install ia32-libs
If not, adb wil not work."


what about the line for a non 64 bit system?
Title: Re: How to setup the Android SDK globally
Post by: N4RPS on September 25, 2014, 10:51:35 PM
Hello!

UIAM, the ia32-libs library is used to make some of the 32-bit-only Linux programs to work properly on the 64-bit OS, so just disregard the ia32-libs part...

73 DE N4RPS
Rob