Happening now! New Honor Phone Launch
FORUMS
Remove All Ads from XDA

[GUIDE] How to install SDK/ ADB and do a Logcat and some essential guides

1,407 posts
Thanks Meter: 2,540
 
By Red Devil, Senior Member on 10th February 2013, 06:24 AM
Post Reply Email Thread
Hello everyone at xda !

As a newcomer I was searching for a bit of help getting started with android tools and its development.
So I decided to help out the newcomers a bit more by creating this thread..
I found this to be essential for our HTC Explorer Development Forum

This guide contains :
Post 1:
  1. Info about SDK / ADB and how to install them on linux and windows.
  2. Logcat- How to logcat , types of logcats , meaning
  3. Adb wireless
Post 2:
  1. Clean install
  2. Paritioning sd
  3. Flashing kernel , recovery
  4. Permissions
  5. What is overclocking ?
  6. Recover from OC
  7. md5 checksum
Post 3:
  1. Video tuts and credits.

Info about ADB/SDK :

ADB

What is adb ?

Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device. It is a client-server program that includes three components:

A client, which runs on your development machine. You can invoke a client from a shell by issuing an adb command. Other Android tools such as the ADT plugin and DDMS also create adb clients.
A server, which runs as a background process on your development machine. The server manages communication between the client and the adb daemon running on an emulator or device.
A daemon, which runs as a background process on each emulator or device instance.

SDK
What is android SDK ?

Android software development is the process by which new applications are created for the Android operating system. Applications are usually developed in the Java programming language using the Android Software Development Kit, but other development tools are available. As of October 2012, more than 700,000 applications have been developed for Android, with over 25 billion downloads.The Android platform has also grown to become a favorite among mobile developers.


Want to download and use adb and SDK ( its in one package )?
Visit http://developer.android.com/sdk/index.html

Extract the files of the package you downloaded from the site as whatever you want to but remember it ?

Windows Specific (VISTA)

Keep your path name to which is extracted to
Eg : C:\(*package-name*) [ eg of package name : adt-bundle-windows-x86 ]

Rename the Folder to C:\(*Whatever you want to name it*) [ eg change "adt-bundle-windows-x86" to "android" ]
In order to run adb do the following steps :
  • Click start
  • Search for cmd
  • Right click and * RUN AS ADMINISTRATOR *
  • type the following commands
    Code:
     
    C:\Windows\system32\>cd C:\android*\sdk\platform-tools\ [*click enter*]
    C:\android*\sdk\platform-tools>adb
    C:\android*\sdk\platform-tools>adb devices

Now you should get a huge code block with all the adb commands
That means adb has been installed correctly.
adb devices gives you the list of attached adb devices and if their permissions are right..

Setting up ADB as a command on Windows 7/ Vista
  1. Assuming you have done the above steps correctly you should have no problem going ahead
  2. Right click on Computer
  3. Click on properties
  4. Go the advanced system settings
  5. Click on the advanced tab
  6. Go to Enviornmental variables in the dialog box
  7. In system variables find the variable " Path ".
  8. Double click on it and in variable value add the following line at the end of it :
    Code:
     ;C:\android\sdk\platform-tools\;
  9. Click on OK etc and save the settings
  10. now Run command prompt
  11. Type adb and your adb commands will be in function..
  12. You can now run adb as a command and dont need to go to the directory every time.

Linux Specific ( Ubuntu )
  1. PS (important) if someone has a 64bit linux then they need to download 32bit libs
    for this, before all these steps run this

    Code:
    sudo apt-get install ia32-libs
  2. You should have an updated JDK for this.. Just in case..
    Code:
     $ sudo add-apt-repository ppa:sun-java-community-team/sun-java6
    
    $ sudo apt-get update
    
    $ sudo apt-get install sun-java6-jre sun-java6-bin sun-java6-jdk
  3. we need to make a new directory by this command
    Code:
    mkdir android
    then extract by
    Code:
    tar -zxvf ~/Downloads/android-sdk_r21.0.1-linux.tgz
    then move it to the directory we just made
    Code:
    mv android-sdk-linux ~/android/sdk
  4. the open android sdk manager by
    Code:
    android/sdk/tools/android
    this will open android sdk manager
    we need to select just android sdk tools and android sdk platform tools for adb and then select install packages
    ^^this will download everything required
  5. then we need to set a path to include adb
    Code:
    gedit .bashrc
    and then a file opens and paste this text in that file
    Code:
    export PATH=${PATH}:~/android/sdk/platform-tools
  6. then we make the above bashrc file executable by this
    Code:
    chmod a+x .bashrc
  7. then we need to setup device rules and make that file executable


    ps sample is the username
    Code:
    ]sudo gedit /etc/udev/rules.d/51-android.rules
    and copy and paste this

    Code:
    SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666"
    SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0666"
    SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0666"
    SUBSYSTEM=="usb", ATTR{idVendor}=="091E", MODE="0666"
    SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666"
    SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666"
    SUBSYSTEM=="usb", ATTR{idVendor}=="0482", MODE="0666"
    SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666"
    SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666"
    SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0666"
    SUBSYSTEM=="usb", ATTR{idVendor}=="10A9", MODE="0666"
    SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666"
    SUBSYSTEM=="usb", ATTR{idVendor}=="04dd", MODE="0666"
    SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666"
    SUBSYSTEM=="usb", ATTR{idVendor}=="19D2", MODE="0666"
    and then make rules executable by:

    Code:
    sudo chmod a+x /etc/udev/rules.d/*
    we need to add full path to adb start server
  8. Type :
    Code:
    sudo gedit /etc/rc.local
    this will open a file
    now add this line just above where it is written exit 0

    Code:
    /home/sample/android/sdk/platform-tools/adb start-server
    "sample is username"
  9. after this we dont need to cd to adb directory..we can just type adb devices and the phone will surely show up


    Guide for Linux by Gnexus. Thank him Here!


Now we have a blooming xda forum at HTC Pico aka Explorer with :
  1. Cyanogen mod 7
  2. Cyanogenmod 9
  3. Cyanogenmod 10
  4. Cyanogenmod 10.1
  5. Sense 3.5(stock)
  6. Sense 4.0

Which is quite a lot considering our device is considered as
Quote:

A legacy / low activity device

Now with all those ROMs come their respective bugs..
Just saying

Quote:

" Random reboot > "
" I dont know but xyz doesnt work "
" Xyz fces "

Gives just another burdening job for a ROM dev of trying to find that same mistake and trying to take a log of it..

At times they are on a different ROM and it becomes difficult for them to flash their old ROMs again..
Sometimes they dont even have the same device !!

So.. Try to ease the job of the dev by bringing whats called a logcat so you can do the following to help them out :

You should have installed adb and fastboot by now

For getting a logcat you should do the following easy steps
  1. Connect phone to pc / laptop ( quite obviously )
  2. Assuming you have rooted your phone you should have required drivers installed ?
  3. To enable ADB mode on your phone go to settings > developer options > Debugging > USB Debugging > ON
  4. 1st go to cmd and run as administrator and go to the root of adb
  5. simply type
    Code:
    C:\android*\sdk\platform-tools>adb logcat
    and you get a logcat running on your screen
Want to post a logcat somewhere ?

1] A logcat that can be easily copy pasted and given to someone else :
to do that type :
Code:
 
adb logcat > cat.txt
*cat is just an example .. it can be Anything logcat.txt, catlog.txt, etc ( let your imagination go wild )
This gives you a logcat at the platform-tools folder .

Now if you get your logcat you can post the logcat somewhere in the dev threads as a whole logcat or you can put specific lines where you want the dev to look at or you know the error is present. There is a character number limitation on a single post on xda for which you can simply upload the .txt file or you can also post it on Pastebin and share the link/url on the thread. This helps a lot .

Alternatively there are apps such as aLogcat or Catlog but installing adb and fastboot is essential as it will not only help you with this but other functions also look further down..

Meanings of symbols in a logcat !

You usually see this at the start of a sentence in logcat .
I/> ===> Information
S/> ===> Silent
D/> ===> Debug
W/> ===> Warning
E/> ===> Error
F/> ===> Fatal

For more information about logcats

Help with solving a logcat from fellow members only for pico !
DMESG (*Useful for devs / beta testers alike*)
  1. Go to your adb directory via terminal / cmd on admin privileges
  2. Type
    Code:
    adb shell dmesg > dmesgLOG.txt
  3. Terminal emulator :
    Code:
     dmesg > /sdcard/dmesglog.txt

DMESG is useful for finding out errors / bugs in the hardware aspects caused due to software issues and kernel issues (* eg : deepsleep , bluetooth not working , wifi not working etc . *) which cannot sometimes be easily solved through a simple logcat.

Lastly K-MESG
To help solving with respect to kernels (* Yes it is a kernel not kernal... *)
Kernel issues like a kernel panic and similar. Similar steps to dmesg but the code is
Code:
 adb shell cat /proc/last_kmsg > kmsg.txt (*via adb*)
 cat /proc/last_kmsg > /sdcard/last_kmsg.txt (*via terminal emulator*)
ADB wirelessly

To use adb via Wi-Fi
  1. Download this wonderful app from the playstore adbWireless
  2. Click on the green button and an IP will come on the app screen. (* eg: 123.456.7.890 *)
  3. On your computer go to your adb directory via terminal / cmd prompt
  4. type
    Code:
     adb connect 123.456.7.890
Voila! You are using adb wirelessly


Some useful extra stuff !
Adb guide
Note : Please do not quote the entire first post in the replies !
The Following 34 Users Say Thank You to Red Devil For This Useful Post: [ View ] Gift Red Devil Ad-Free
 
 
10th February 2013, 06:24 AM |#2  
Red Devil's Avatar
OP Senior Member
Flag Mumbai
Thanks Meter: 2,540
 
More
Some other essential guides.
What do you mean by a clean install ?

WARNING ! : Do NOT wipe/format External storage . This will result in the loss of data.

A clean install can be done as follows :

On CWM / Yannou's recovery :
  1. Boot into recovery
  2. Do a factory reset
  3. Go into mounts and storage using volume rockers and power button.
  4. Format /system /boot /cache
  5. Go to advanced : Wipe Dalvik Cache.

On TWRP Recovery :
  1. Go to wipe
  2. Wipe Cache , Dalvik Cache , System SD Ext and then do a factory reset.
Done ! Now flash the required ROM you want to flash!


How to partition SD card ?

Note :
  • This will result in your SD card being formatted. So always keep a backup of all your files on your computer.
  • For Stock ROM you need a FAT 32 partition which can be done via computer ONLY.
Via Recovery
  1. Boot into recovery
  2. Go to advanced
  3. Partition SD card (*EXT 2,3,4 etc.*)
  4. Select EXT Size *to whatever you want to preferably 512 mb or more*
  5. Select Swap = 0 mb as Explorer doesnt support swap. ( at least till now )
  6. Partition SD card! (*Will take some time*)
  7. After partitioning is done just remove your SD card (*while your phone is off*) and just insert it back in manually.
  8. Reboot /system (*if you have a ROM installed*)
  9. Connect to PC and check for bad partitions just in case.

Steps 7,8,9 are not mandatory but are a good practice.

Via a computer : ( Windows )

Requirement :
  1. SD Card reader
  2. MiniTool Partition Wizard Home Edition 7.7 .

For further details on this visit this great guide


How to flash custom recoveries / kernels ?

How to flash a custom recovery ?
  1. Via computer
    1. Copy the recovery.img of the custom recovery you are try to flash and paste it in the adb directory ( for windows ==> C:\android\sdk\platform-tools\*paste here* )
    2. Boot your Pico into bootloader (*remove battery and after 3-4 secs press vol. down and power button simeltaneously*)
    3. In bootloader menu connect pc to your phone via usb cable and then there will be a red coloured sign just above the options saying
      Quote:

      FASTBOOT USB

    4. Now start
    5. Windows Go to platform-tools directory in command prompt and type
      Code:
       fastboot flash recovery recovery.img 
      fastboot reboot
    6. Linux Go to the directory of adb and fastboot and type in terminal
      Code:
       $ ./fastboot flash recovery recovery.img && fastboot reboot
      or if path is set directly..
  2. Via phone Terminal Emulator
    Take the recovery.img that you want to flash and place it on your sd card ( eg /sdcard/(*here*) )
    Begin Terminal emulator app (*Download from playstore*)
    Type su (*enter*)
    Allow superuser permissions (*enter*)
    Note : Now you must get a line beginning with $
    Enter
    Code:
     flash_image recovery sdcard/recovery.img
    Still racking your brains over this ? Check out post 3 for video tuts !
For kernels do the same thing except replace replace Recovery.img with Boot.img


Setting permissions

Heard about setting permissions ? Ever wondered what they are ?

Quote:

On a UNIX based system, every single file and folder stored on the hard drive has a set of permissions associated with it, which says who is allowed to do what with the file. Every file (and folder) also has an "owner" and a "group" associated with it. If you created the file, then you are usually the owner of that file, and your group, or the group associated with the folder you created the file in, will usually be associated with that file.

So how to configure them ?
You need a file explorer with Root access
Go to the required folder/app you want to set a permission and long press on it ( in most file explorers )
You will get something like this:

Select what is required and close.

Alternative via adb
Same as before from adb directory on cmd propt / terminal
Code:
 
adb shell
su
chmod 777 /system/app/Notes.apk
INDEX :
r = read w = write x = execute
Reference for chmod


So 777 = rwxrwxrwx 755 = rwxr-xr-x and so on and so forth..



What is overclocking ?

Overclocking is the process of making a computer or component operate faster than the specified clock frequency by the manufacturer by modifying system parameters. One of the most important techniques is running at a higher clock rate (more clock cycles per second; hence the name "overclocking")..
Operating voltages may also be changed (increased), which can increase the speed at which operation remains stable.

Pros : You get much more performance including gaming performance and overall UI performance..

Cons : Overclocking is always risky if something is configured improperly and may also result in permanent damage of your hardware. As long as it is done safely you are good to go.
You may see some increased power consumption.
Extreme overclocking might kill your hardware.

Undervolting :

The process where you provide less voltage to your cpu rather than the stock voltage.

Advantage:

Reduced heat from your device.
Good battery life.

Disadvantage:

Extreme undervolting will make your device unstable and some times even end up with a boot loop.


Recovering from an OC NAND Wipe..

Quote:
Originally Posted by cute_prince

Ok guys, here I am posting NAND Recovery Procedure:

Download the following attachment.. Rename flash_erase.txt to flash_erase ( Its actually a binary file )

Copy this file to /system/xbin directory using Root Explorer. Set permission as 755

Make sure Root Access is enabled for both Apps and ADB in Developer settings

Connect phone to PC .. Now open a terminal ( I am using Ubuntu ) and type the following:

Code:
adb shell
su
cd /system/xbin
./flash_erase -N /dev/mtd/mtd2 0 0
./flash_erase -N /dev/mtd/mtd4 0 0
./flash_erase -N /dev/mtd/mtd5 0 0
Note: when you execute above command you may get an IO error.. Its OK, dont get panic

Now disconnect phone from PC.. Remove battery and reinsert it ..

Goto recovery and:

format /boot
format /system
wipe data / factory reset

Now install your favourite ROM

Once the ROM is booted, goto storage settings.. Everything should be fine now and you should get around 140MB free depending on your ROM



What is md5 ? How is it useful?

The MD5 Message-Digest Algorithm is a widely used cryptographic hash function that produces a 128-bit (16-byte) hash value. Specified in RFC 1321, MD5 has been utilized in a wide variety of security applications, and is also commonly used to check data integrity. MD5 was designed by Ron Rivest in 1991 to replace an earlier hash function, MD4. An MD5 hash is typically expressed as a hexadecimal number, 32 digits long.

What does it mean in english ?

For android basically it is used to maintain the uniqueness of a file. It is also used to check wheter the file is the same file that has been uploaded or not .. or wheter the the downloaded file is half downloaded or broken..

You can check the md5 sum of two files. If they match then they are the same file. If they dont .. back to your download screen.

How do I check the md5 sum ?

On windows :
  1. Download this and extract it on your pc..
  2. Just put in the file's location..
  3. Get the md5 sum from the OP
  4. Match them ..
On android

There is an app for it : Android Filve Verifier
Attached Files
File Type: txt flash_erase.txt - [Click for QR Code] (102.5 KB, 145 views)
The Following 21 Users Say Thank You to Red Devil For This Useful Post: [ View ] Gift Red Devil Ad-Free
10th February 2013, 06:26 AM |#3  
Red Devil's Avatar
OP Senior Member
Flag Mumbai
Thanks Meter: 2,540
 
More
Video Tutorial # 1 : How to flash any recovery thru terminal emulator ! By Rishik







Video Tutorial # 2 : How to take a backup of your system! By Rishik








Please thank him for it.. HERE !

Credits : bala_gamer, cute_prince , Genexus , Rishik999, wikipedia , sdk , many tutorials on xda and other forums... and google.
The Following 8 Users Say Thank You to Red Devil For This Useful Post: [ View ] Gift Red Devil Ad-Free
10th February 2013, 06:33 AM |#4  
Account currently disabled
Flag New Delhi
Thanks Meter: 3,275
 
More
Re: [GUIDE] How to install sdk / adb and do a logcat
Wrong section post in general this isnt any development

Sent from my HTC Explorer A310e using xda premium

---------- Post added at 12:03 PM ---------- Previous post was at 12:01 PM ----------

Mods move this to general!

Sent from my HTC Explorer A310e using xda premium
10th February 2013, 06:36 AM |#5  
Red Devil's Avatar
OP Senior Member
Flag Mumbai
Thanks Meter: 2,540
 
More
I knew this was coming .. It is in many development sections even for my old device Sensation. Trust me it is needed in the development section. Mods are free to move it.. Even mentioned it in the first post.. as good as a guide on rooting the pico or even compiling a kernel. Dont you think ?

If you think the people actually read the general section why would the dev thread be full of so much spam ?
The Following User Says Thank You to Red Devil For This Useful Post: [ View ] Gift Red Devil Ad-Free
10th February 2013, 06:50 AM |#6  
7alvi's Avatar
Senior Member
Flag Kanpur, Delhi
Thanks Meter: 1,314
 
More
good..nice..
i think this will work on win 7 also??
and give a tut for linux too...if you want i can post one here!!
10th February 2013, 06:53 AM |#7  
Red Devil's Avatar
OP Senior Member
Flag Mumbai
Thanks Meter: 2,540
 
More
Adding a lot.. Even video tuts.. if possible..
10th February 2013, 02:34 PM |#8  
Rishik999's Avatar
Senior Member
Thanks Meter: 771
 
More
Video Video Tutorials
I have recently made a tutor on how to flash recovery.img through terminal emulator
I guess OP needed them?
I hope,he wont mind sharing them

http://www.youtube.com/watch?v=ND9UvfV3G34


Liked it
Please hit the like button on the vedio
Ofc the thanks button also

Disliked?
Nevermind

Thanks!
The Following 2 Users Say Thank You to Rishik999 For This Useful Post: [ View ] Gift Rishik999 Ad-Free
10th February 2013, 03:00 PM |#9  
Senior Member
Thanks Meter: 44
 
More
Re: [GUIDE] How to install sdk / adb and do a logcat
Can u add guide how to adb via wireless

Sent from my HTC Explorer using xda app-developers app
The Following User Says Thank You to KiranP23 For This Useful Post: [ View ] Gift KiranP23 Ad-Free
10th February 2013, 04:27 PM |#10  
Red Devil's Avatar
OP Senior Member
Flag Mumbai
Thanks Meter: 2,540
 
More
Re: [GUIDE] How to install sdk / adb and do a logcat
Quote:
Originally Posted by KiranP23

Can u add guide how to adb via wireless

Sent from my HTC Explorer using xda app-developers app

Yeah was about to add it soon...





Quote:
Originally Posted by Rishik999

I have recently made a tutor on how to flash recovery.img through terminal emulator
I guess OP needed them?
I hope,he wont mind sharing them

http://www.youtube.com/watch?v=ND9UvfV3G34


Liked it
Please hit the like button on the vedio
Ofc the thanks button also

Disliked?
Nevermind

Thanks!


Adding them bro thanks a lot .. I'll pm you



Sent from my HTC Explorer A310e using xda premium
The Following User Says Thank You to Red Devil For This Useful Post: [ View ] Gift Red Devil Ad-Free
10th February 2013, 05:39 PM |#11  
Rishik999's Avatar
Senior Member
Thanks Meter: 771
 
More
Prompt logcats
Thanks a lot OP for making this noob friendly guide!

This really helped me,in getting logcats ..Where first I use to scratch my brains :P
Such guide will definitely gonna boost up development ! As there would less of noobish post!

Please,add as much as u can in these guides!
U can still add on ..How to read logcats?

Anyways,I found it really helpful!
The Following 2 Users Say Thank You to Rishik999 For This Useful Post: [ View ] Gift Rishik999 Ad-Free
Post Reply Subscribe to Thread

Tags
adb logcat, android sdk, essential guides, tutorial

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes