Install multipple applications from PC using ADB in single command!!! - Android General

Maybe most of us already knowing this, I am making a note of this technique so that it will be helpful for others.
It's a windows batch file script which will install all the applications to phone in single shot. Phone is not necessarily rooted. Only if you are pushing system app then root is required.
You need apk files on your computer, kept together in a folder.
Connect your phone to system using USB cable.
Make sure adb.exe is in the system 'path' environmental variable. (If not replace adb with fill adb path of adb.exe in below script)
Create a batch file with following contents in the same folder where apk files are kept -
Code:
adb wait-for-device
@echo off
adb remount
for /f %%a IN ('dir /b *.apk') do call adb install "%%a"
echo now phone will reboot.
pause
adb reboot
Save and run the batch file. It will install each app one by one.
If you want to speed up the installation, you can install apps using push method. Below is script for that.
Code:
adb wait-for-device
@echo off
adb remount
for /f %%a IN ('dir /b *.apk') do call adb push "%%a" /data/app/
echo now phone will reboot.
pause
adb reboot
Also if you want to install system application, replace /data/app/ with /system/app/ in above script.

Was about to make a post to look for this. Gonna test this next time I format the Device.
Thanks Mate!

Thanks for your quick guide, This is ready helpful to me.

Thanx
thanx for Guide
i am testing via adb command and OK

Related

ADB Uninstall Failure

I adb pushed some .apks from a Froyo zip onto my mytouch1.2 but they didnt work...
when I try to uninstall them I get a failure message... and when I try adb shell... blah blah blah..."ls" the files arent there...
any help is appreciated
how to uninstall
I've tried a few methods.
The one I've found that works the best is this : mv <source> <destination> ...it's supposed to be a move command but it actually deletes files. rm also likely does the same (eg rm <filename.filetype OR foldername>)
BEFORE using these commands though, type in
adb shell <enter>
cd <foldername> <enter>
cd <foldername> <enter>....to get to folder (directory) of your choice
**TO get to app directory to uninstall apps, do cd system -->cd app -->mv appname.apk
I use the /sdcard as the destination for the mv command - I noticed the files NEVER get moved so this is just a delete command.
You could also delete a whole folder with this command. do cd system
mv app /sdcard
(this would delete the entire app folder/directory from the device).
That's pretty much it. Works for me. Was trial and error though - adb uninstall command ALWAYS resulted in 'failure ' or 'file not found' and the same with adb shell --> # uninstall appname.apk ---> 'failure'.
So I hope this works for you! Good luck .
str8arrow
NOTE: I've had an awful time because my stupid tablet has refused to download things from the market. It stalls in the initial 'starting download' bit and then just hangs, and then says 'download failed'. Apparently there's some problem with the sync'ing but I can't log into Gmail or GoogleTalk to try to resolve this (Gmail won't allow me to enter anything - left it on overnight and it said 'getting mail' / 'sync in progress' and the sync never completed after 12 hrs. The GoogleTalk app just displayed a black screen. So I am getting nowhere.
if anyone knows how to fix this pls let me know. I'm apparently not the only one. Others /various tablets have had similar issues - I have a 7" BPDN (Pandigital black novel).
Please, help!
str8arrow
adb shell <enter>
then
cd system
cd app
mv <filename.apk> <destination> (this should move the file BUT it never shows up in destination or elsewhere, so this is effectively a delete command, you could also do mv <foldername> <destination> to delete a whole folder.
**I usu. use /sdcard as my destination. so mv filename.apk /sdcard
OR
cd system
cd app
rm <filename.filetype> does the same sort of thing.
(eg adb shell <enter>
**I tried the uninstall commands listed but.. (adb uninstall-->'failure', or 'file not found' etc, adb shell --> uninstall --> same error).
Commands for removing apps.
I run as root on all my OS's, so I don't have to navigate to my sdk directory. I just type "adb devices", I don't know how your adb is setup, but get adb running and run these commands.
adb remount
adb shell
rm /system/app/whatever.apk
Or whatever path you pushed the files to. Try running fix_permissions to make your apps run properly and stop FC issues

[How to] [Linux] Root Hboot 2.02

For anyone having issues with running this in linux.
I used zikronix guide and modified it for use in a linux support thread. The original thread can be found here:
http://forum.xda-developers.com/showthread.php?t=829045
This is my setup:
-I made sure to show my .bashrc profile and path to my tools folder if you needed help getting that setup as well... If not please ignore.
Code:
[email protected]:~$ cat .bashrc | grep adb
alias start-adb='sudo /usr/local/android-sdk/tools/./adb start-server'
alias kill-adb='sudo /usr/local/android-sdk/tools/./adb kill-server'
[email protected]:~$ cat .bashrc | grep android-sdk
export PATH="/usr/local/android-sdk/tools/:${PATH}"
[email protected]:~$ $PATH
bash: /usr/local/android-sdk/tools/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:
Download: http://www.wackynoodle.com/hboot202-s_off-V6.2.zip
Download (Mirror): http://sdx-downloads.com/EVO/devs/jerdog/fixes/hboot202-s_off-V6.2.zip
Now This might make things easier.
-I have this so that you are in the same enviroment that i was in so that the paths will be the same.
Code:
wget http://www.wackynoodle.com/hboot202-s_off-V6.2.zip
mkdir Evo-root
mv hboot202-s_off-V6.2.zip
cd Evo-root
unzip hboot202-s_off-V6.2.zip
- This step I just made sure that adb devices showed my device. If not get it working.
- Once adb devices showed my device properly, I simply ran the following commands.
Code:
adb push root/unrevoked-forever.zip /sdcard/
adb push root/mtd-eng.img /sdcard/
adb push pc36img/PC36IMG-ENG.zip /sdcard/PC36IMG.zip
adb push root/flash_image /data/local/
adb push root/rageagainstthecage /data/local/tmp
adb push root/amon_ra.img /sdcard/
- Then this is just changing permissions. Pretty straight forward.
Code:
adb shell
chmod 0755 /data/local/tmp/rageagainstthecage
chmod 0755 /data/local/flash_image
- Running the script. Should kick you out of adb... If not after 5 min kill the adb server and restart.
Code:
adb shell
./data/local/tmp/rageagainstthecage
- Now you should see a "#", if you do proceed. If not then run the script above again till it works.
Code:
adb shell
- If you saw that "#" run this. This can only be ran as root "#" means root.
Code:
./data/local/flash_image misc /sdcard/mtd-eng.img
Now you are going to want to reboot into the bootloader. Make sure once you do that you selet bootloader and let the PC36IMG.zip load.
Code:
reboot bootloader
After that is done reboot into the new rooted rom. Then make sure adb works again. Then run the following commands. Make sure you terminal is in the same directory this entire time there is no reason to leave the direcory we went into earlier "cd Evo-root" You directory should always be Evo-root. Thanks. The part that I found out was the second command where the entire recovery/ needed the permissions changed to be executable. As you saw in my post on that forum board.
- This will remove the PC36IMG.zip to a different name so that the bootloader won't get confused again. Then the second commands makes the directory executable recursivly. Then the third will reboot you into recovery.
Code:
adb shell mv /sdcard/PC36IMG.zip /sdcard/PC36IMG-ENG.zip
chmod -R +x recovery/
adb reboot recovery
- Now this is going to be done at the recovery screen. As long as you followed the steps above it will work fine. Should only take you about 20 mins to root this phone. Though it took me about 2 hours since no one else has been rooting using linux. I am thinking about writing a script that will root everything and alls you have to do is follow a terminal guide.... But ill see.
- Just run these commands that will allow you to flash the unrevoked-forever.zip. Once you follow the onscreen instructions of the unrevoked-forever.zip you will be able to reboot into the recovery and see the S-Off. Once that is done reboot into the rom, now we need to flash a custom recovery!
Code:
adb push recovery /
adb shell busybox --install /sbin
adb shell nohup /sbin/recovery &
- Again make sure your terminal was never closed and in the same folder. Then simply run these commands to flash the Amon_ra recovery. Since it has wimax capabilities I prefer it.
Code:
adb push root/flash_image /data/local/
adb shell
chmod 0755 /data/local/flash_image
./data/local/flash_image recovery /sdcard/amon_ra.img
reboot recovery
Now you should see the custom recovery and you should be able to flash any rom you desire!
reserved for later use
i see that they are same commands as the pc.., so would this also work with PC?
nickespi said:
i see that they are same commands as the pc.., so would this also work with PC?
Click to expand...
Click to collapse
I am guessing your talking about windows? Sure make sure adb is in your path. Though there are steps in here that are only for linux.
95% success
Well I want to thank you for this thread
It has worked for me I have root I have NAND unlocked
I can flash ROMs
The only issue I have is my radio/baseband and PRI version have been lowered
I have not been able to get thise back where they whould with either update or by using teh wimax.ADDRESS.tree.xml fix (there is no file with that)
If you have any ideas how to fix this would be much appreciated
I am unable to get higher tahn baseband 1.36.00.04.02 in ant rom
when I got teh phone it was 2.15.00.xx.xx
any help would be appreciated
100% Success
THANK YOU
My Evo
Hardware 004
Build 3.30
Hboot 2.02
Baseband 2.15.xx.xx
is now sucessfully rooted.
I did have some problems after being able to flash ROMs of not haveing PRI and Baseband updated.
On thread #787756 there are downloads that can be flashed to fix this problem if anyone else is in that boat.
zikronix sent me there for the fix...I believe he is adding it to the main thread but if it isn't there yet I wanted to add it now for anyone in my boat.
Again this method works and there is success.
Happy rooting
Hey thanx for this Linux guide. Does this steps work with the update 12.25.10 on the windows thread?
Will you update this guide?

[FIX] [GUIDE] ADB command not found issue

Hi, I'm posting this because I had a lot of problems with ADB shell and its drivers, etc.
Problem: when you try to input a command inside ADB like REBOOT , ADB shell comes back as " ADB: not found"
PPL say you need to re-install drivers, java, SDK, etc.. well none of that worked for me and many users here. I even tried to reinstall Windows.. but that was a no go ether.
FIX: the only way that I could make ADB to send commands to the phone was making a .BAT file and add the commands in there and execute the bat to run the ADB commands.
GUIDE: this is what's inside the .BAT
:cd %:h
adb wait-for-device
**YOUR COMMANDS HERE**
adb wait-for-device
adb shell sync
pause
now for example: you have a THREAD that describe what you need to do to push files with ADB like this
1) Unzip the two files into the directory where ADB is kept
2) Get to that directory in command prompt
3) Connect your phone if you haven't done so already
4) adb remount
5) adb push gps.conf /system/etc
6) adb push SuplRootCert /system/etc
7) adb reboot
now the only thing that you need to do is RIGHT CLICK the Auto ADB.BAT and click EDIT
:cd %:h
adb wait-for-device
**YOUR COMMANDS HERE**
adb wait-for-device
adb shell sync
pause
Just copy and paste the ADB commands from the THREAD there, like this.
:cd %:h
adb wait-for-device
adb remount
adb push gps.conf /system/etc
adb push SuplRootCert /system/etc
adb reboot
adb wait-for-device
adb shell sync
pause
and close and save the changes, after you inputted your commands just place the Auto ADB.BAT in the folder where you have ADB shell install (E.X: "adb.exe" C:\AndroidSDK\Tools or \Desktop\ADB where you install it or downloaded the folder)
After that it's done. Every time you want to use ADB just EDIT the .BAT, close, save, and execute the .BAT.
Here I leave some THREADS in reference for installing ADB and its components.
[GUIDE] (For Noobs) SDK, ADB, and Drivers
Posted by the user *MLIGN*
Basic adb/shell commands for noobs
Posted by the user *brandenk*
The method mention above (Auto ADB.BAT) it's the last resort when everything else fails and you cannot send commands to adb shell.
I hope this will help some ppl, I spent many days trying to find out a way to make ADB work and this is what I found.
Please be nice in here and if you found another way, I gladly post it up front.
And remember to say Thanks if I helped you
thanks!
matury said:
Hi, I'm posting this because I had a lot of problems with ADB shell and its drivers, etc.
Problem: when you try to input a command inside ADB like REBOOT , ADB shell comes back as " ADB: not found"
PPL say you need to re-install drivers, java, SDK, etc.. well none of that worked for me and many users here. I even tried to reinstall Windows.. but that was a no go ether.
FIX: the only way that I could make ADB to send commands to the phone was making a .BAT file and add the commands in there and execute the bat to run the ADB commands.
GUIDE: this is what's inside the .BAT
:cd %:h
adb wait-for-device
**YOUR COMMANDS HERE**
adb wait-for-device
adb shell sync
pause
now for example: you have a THREAD that describe what you need to do to push files with ADB like this
1) Unzip the two files into the directory where ADB is kept
2) Get to that directory in command prompt
3) Connect your phone if you haven't done so already
4) adb remount
5) adb push gps.conf /system/etc
6) adb push SuplRootCert /system/etc
7) adb reboot
now the only thing that you need to do is RIGHT CLICK the Auto ADB.BAT and click EDIT
:cd %:h
adb wait-for-device
**YOUR COMMANDS HERE**
adb wait-for-device
adb shell sync
pause
Just copy and paste the ADB commands from the THREAD there, like this.
:cd %:h
adb wait-for-device
adb remount
adb push gps.conf /system/etc
adb push SuplRootCert /system/etc
adb reboot
adb wait-for-device
adb shell sync
pause
and close and save the changes, after you inputted your commands just place the Auto ADB.BAT in the folder where you have ADB shell install (E.X: "adb.exe" C:\AndroidSDK\Tools or \Desktop\ADB where you install it or downloaded the folder)
After that it's done. Every time you want to use ADB just EDIT the .BAT, close, save, and execute the .BAT.
Here I leave some THREADS in reference for installing ADB and its components.
[GUIDE] (For Noobs) SDK, ADB, and Drivers
Posted by the user *MLIGN*
Basic adb/shell commands for noobs
Posted by the user *brandenk*
The method mention above (Auto ADB.BAT) it's the last resort when everything else fails and you cannot send commands to adb shell.
I hope this will help some ppl, I spent many days trying to find out a way to make ADB work and this is what I found.
Please be nice in here and if you found another way, I gladly post it up front.
And remember to say Thanks if I helped you
Click to expand...
Click to collapse
Thanks am new here and I had the same problem I couldn't get the adb to respond at all, I did reinstall and all but it came back as not found, however this method worked fine. Thanks

[GUIDE]( Easiest) All about ADB, logcat, shell

ADB:-
Android Debug Bridge
Very useful program made itself by Google for Programmers and developers. Its based on command line and basically communicates with your Android to respond to certain commands. There is vast amount of knowledge about adb but its most useful commands limit to getting:-
Logcat:-
A real time log of what is happening in background of our devices. It is really useful for developers to see which component has malfunctioned and helps to narrow down their search for what failed and what needs to be fixed. Several times users are asked to give logcats of their devices which are giving errors. We will go in detail that how to get logcats in every and easiest way possible.
App Installation and Management:-
adb proves really handy if you want to install apks directly from your PC or want to batch install or delete them.
Shell Execution:-
You must have heard of Terminal Emulator. It is an app for android to execute shell commands(linux commands) which are basically present as applets in /system/bin, /system/sbin or /system/xbin(in our case) folders. A very imporant applet called busybox is installed there mainly used for execution of basic commands during root browsing or ROM installation. Many times updater script of ROMs use busybox commands to install it. Well, these commands can be initiated from your device too but they can be initiated from adb also making it easy for programmers.
Pushing and Pulling:-
Most used commands of adb. adb makes it a piece of cake for new device developers to get an ideo of structure and basic knowledge of devices by pulling command. We can pull out i.e copy any files or folders from our devices to our PC, even the root directories without rooting the devices. It help rooters and ROM chefs of new devices to get an idea and implement their mods on them. Pushing is also very useful command. It copies your files and folders from PC to your device. Very useful in pushing some /system apps and other things
Remounting and setting permissions
Basic commands:-
Of-course basic commands such as reooting and rebooting in recovery ode and download mode are supported.
Others:-
There are several other features of adb such as fastboot, aapt, etc
Setting up ADB
Pre Requirements:-
A little amount of brain
PC(This is a windows guide, if asked I will add linux and mac guide later)
Java Runtime environment or Java Developing kit
Your Device Drivers
An Android Device
Assuming you all these ready and working properly, we continue
If you are having trouble completing Pre-Requisites, there are several guides featuring them too
Start
1. First Download Android SDK. Roughly about 70 MB
2. There may be any compressed zip file or exe file
If zip file, then extract it to C:\android-sdk
If exe file then double click on it and install it in C:\ Drive(or any other drive you want)
3. Now to get adb and other tools, you need to download 'Platform Tools'
To download them, go to the android-sdk folder and double click on SDK Manager
It will ask you which package to download? However, it is your choice which package to Download, but here, we will only talk about platform
Tools. So, simply tick on Platform Tools and click on install. Once you have done it. Go to the platform-tools folder in the directory where you installed android-sdk. You will find several files there like adb, fastboot, aapt, etc
4. Now, you can backup the whole folder of android-sdk to any external storage that will make you not download package
again if you want to. You can have it placed in any computer and run it as it does not require registry to work
5. Now, you are just one step away from using adb. Next step is SKIPPING SETTING ENVIRONMENT VARIABLE
Many guides on internet say that it is to be done for making it easy for users and if you have some basic knowledge of Command Prompt,
you will know that to execute any application with command prompt, you first need to change the directory to the one where application is
placed. And to skip changing the directories every time you open CMD, you need to put that application is environment variable. Howeve, we will not do so.
6. Type cmd in the search bar. Copy cmd.exe from there. Go to the directory where you have installed android-sdk. Go to platform-tools folder. Paste cmd there, right click on it and in the settings, select Run as Administrator.
7. You are done. Now what to do in it?
ADB Commands
Type adb in command prompt. And several commands will show up on your screen. It is very difficult to analyse these all commands, so we will only talk about most used and important commands
Connect your device via USB cable
And open the CMD in platform-tools folder(Make a shortcut of it on desktop). And type the suitable commands
Code:
adb devices
Will show the list of devices attached to the PC andtheir serial numbers. If this shows up correctly on your PC, then it means that everything is fine for continuing.
Logcat
Code:
adb logcat
It will display the real time log of your device
Best time to do it is when your device boots up
Now, many users ask me how to copy the logcat and upload it from CMD
There are several methods:-
1. Right click on the Title Bar of Command Prompt. Hover the cursor over edit and select mark. Select all the things you want to copy and then click enter. All the things will be copied to clipboard.
2. This is the correct way of getting logcat saved.
Code:
adb logcat > logcat.txt
This command will create a logcat.txt document in platform-tools folder with the complete logcat of the device. Ofcourse you can type any name instead of logcat.txt
3. I prefer taking logcat this way as it neatly compiles logs of different time
Code:
adb logcat -v long > logcat.txt
This is a very nice way to get logcat.
Installing Apps
Code:
adb install %PATH OF APK%
This will install an app on your Android
For example, if my app AreeB.apk is in G:\ drive (G:\AreeB.apk)
Then I will type
Code:
adb install G:\AreeB.apk
Be sure your apk is not in a folder that has space in its name, else the command will break at space bar.
For eg:-
G:\Program Files\AreeB.apk
Mounting
However, I never found any problem in tweaking with system files with adb, but some users said that they couldn't do it, so the problem was that their system partition was mounted as Read Only(R/O)
So, it is necessary now to tell how to mount system partition as Read Write(R/W)
Code:
adb remount
It is easiest way to do so, if it does not work then
There is another method that we will discuss in ADB Shell commands section
Pushing and Pulling
For pushing,
Type
Code:
adb push %PATH TO BE PUSHED% %PATH WHERE TO BE PUSHED%
Suppose I have an app named SystemUI.apk(PATH = G:\SystemUI.apk) which I want to push in /system/app/ on my android(or in other words, install an app as a system app). Then I would type
Code:
adb push G:\SystemUI.apk /system/app/
More examples
G:\Dance.txt file to be pushed in Dance folder in sdcard
Code:
adb push G:\Dance.txt /sdcard/Dance/
OR
Code:
adb push G:\Dance.txt /mnt/sdcard/Dance/
G:\Movies folder to be transferred in SDCARD in Videos Folder
Code:
adb push G:\Movies /sdcard/Videos/
G:\system\framework\framework-res.apk to be pushed in /system/framework/
Code:
adb push G:\system\framework\framework-res.apk /system/framework/
For pulling,
push command replaces with pull and paths are swapped
Code:
adb pull %PATH TO BE PULLED FROM% %PATH TO PLACE PULLED FILE%
Example,
All system apps are to be pulled to G:\ROM\system\app
Code:
adb pull /system/app G:\ROM\system\app\
build.prop to be extracted to desktop
Code:
adb pull /system/build.prop C:\Users\Areeb\Desktop\
However, if a folder is in platform-tools folder, you don't need to type full path
Suppose if I type
Code:
adb pull /system/ system
Then a folder named system will be created inside platform-tools with all the files in system in it
If a file is in platform-tools folder, then also no need to type full path
For example,
There is an app name DeskClock.apk in this folder then, to push it to /system/app, type
Code:
adb push DeskClock.apk /system/app/
ADB Shell Commands
This mode of adb allows you to execute linux shell commands from your PC
These commands can aldo be executed through the mobile using Terminal Emulator
To initiate shell mode
Type
Code:
adb shell
You will get an prompt like this
sh-3.2#
Now you are in shell mode
adb commands won't work here and a new set of commands will work here. But we will only go in a little detail here.
Assuming you are in adb shell mode, I will only type commands that will work on shell. Note:- These commands won't work if you type them alone on cmd. But, these command will directly work on your mobile's Terminal Emulator
As these commands can also work on mobile, I am going to tell you a way of taking logcat on mobile
Type
Code:
logcat
You will see log of your device
To save this
Type
Code:
logcat > /sdcard/log.txt
A file named log.txt will be generated in sdcard
Uninstalling Applications
Code:
cd /data/app
This will change the directory to /data/app
Code:
ls
This will show the list of files in there
Suppose, there is an app named com.opera.browser (Opera Mobile) you want to uninstall it
Type
Code:
rm -r com.opera.browser
This will uninstall the app
Mounting Command:-
Code:
mount -o rw,remount /dev/block/mtdblock3 /system
Miscellanous commands:-
su: Initiates root request
du: Shows file foldrs and size
date: Shows todays date
Forgot next ones, will write later
Credits
Google: For Android and several searchings
Samsung: For Galaxy Ace s5830I
Broadcom: For their Open Sourceness
XDA Forums : For the precious knowledge
My Uncle: For gifting me this Phone
My Teachers: For teaching me English(I would not be here without them)
You: For future Thanks
Till now, thats it, will add some more things later
If any problem, I will add it too
Suggestion? They are welcome

[GUIDE][ADB] How to take a logcat

iamareebjamal said:
ADB:-
Android Debug Bridge
Very useful program made itself by Google for Programmers and developers. Its based on command line and basically communicates with your Android to respond to certain commands. There is vast amount of knowledge about adb but its most useful commands limit to getting:-
Logcat:-
A real time log of what is happening in background of our devices. It is really useful for developers to see which component has malfunctioned and helps to narrow down their search for what failed and what needs to be fixed. Several times users are asked to give logcats of their devices which are giving errors. We will go in detail that how to get logcats in every and easiest way possible.
App Installation and Management:-
adb proves really handy if you want to install apks directly from your PC or want to batch install or delete them.
Shell Execution:-
You must have heard of Terminal Emulator. It is an app for android to execute shell commands(linux commands) which are basically present as applets in /system/bin, /system/sbin or /system/xbin(in our case) folders. A very imporant applet called busybox is installed there mainly used for execution of basic commands during root browsing or ROM installation. Many times updater script of ROMs use busybox commands to install it. Well, these commands can be initiated from your device too but they can be initiated from adb also making it easy for programmers.
Pushing and Pulling:-
Most used commands of adb. adb makes it a piece of cake for new device developers to get an ideo of structure and basic knowledge of devices by pulling command. We can pull out i.e copy any files or folders from our devices to our PC, even the root directories without rooting the devices. It help rooters and ROM chefs of new devices to get an idea and implement their mods on them. Pushing is also very useful command. It copies your files and folders from PC to your device. Very useful in pushing some /system apps and other things
Remounting and setting permissions
Basic commands:-
Of-course basic commands such as rebooting and rebooting in recovery mode and download mode are supported.
Others:-
There are several other features of adb such as fastboot, aapt, etc
Setting up ADB
Pre Requirements:-
A little amount of brain
PC(This is a windows guide, if asked I will add linux and mac guide later)
Java Runtime environment or Java Developing kit
Your Device Drivers
An Android Device
USB Debugging MUST be turned ON in the device for ADB to see it & Developer options is hidden in Android 4.2 and
above, Hitting Build number 10 times in
About Phone/Tablet reveals the menu (Thanks lilHermit for reminding me to add it)
Assuming you all these ready and working properly, we continue
If you are having trouble completing Pre-Requisites, there are several guides featuring them too
Start
1. First Download Android SDK. Roughly about 70 MB
2. There may be any compressed zip file or exe file
If zip file, then extract it to C:\android-sdk
If exe file then double click on it and install it in C:\ Drive(or any other drive you want)
3. Now to get adb and other tools, you need to download 'Platform Tools'
To download them, go to the android-sdk folder and double click on SDK Manager
It will ask you which package to download? However, it is your choice which package to Download, but here, we will only talk about platform
Tools. So, simply tick on Platform Tools and click on install. Once you have done it. Go to the platform-tools folder in the directory where you installed android-sdk. You will find several files there like adb, fastboot, aapt, etc
4. Now, you can backup the whole folder of android-sdk to any external storage that will make you not download package
again if you want to. You can have it placed in any computer and run it as it does not require registry to work
5. Now, you are just one step away from using adb. Next step is SKIPPING SETTING ENVIRONMENT VARIABLE (If you however want to set environment variables. Click on Show Content)
We can easily append the sdk platform-tools and tools folder to your systems environmental path variable directly from command line(cmd) by simply issuing one command and performing a system reboot:
Code:
SETX PATH "%PATH%;[COLOR="Indigo"]SDK_Install_Path[/COLOR]\platform-tools;[COLOR="Indigo"]SDK_Install_Path[/COLOR]\android-sdk-windows\tools" -m
Just replace the "SDK_Install_Path" in the above with the proper path of your SDK installation. Example: C:\android-sdk-windows
(Thanks to WugFresh for telling me :victory
Many guides on internet say that it is to be done for making it easy for users and if you have some basic knowledge of Command Prompt,
you will know that to execute any application with command prompt, you first need to change the directory to the one where application is
placed. And to skip changing the directories every time you open CMD, you need to put that application is environment variable. Howeve, we will not do so.
6. Type cmd in the search bar. Copy cmd.exe from there. Go to the directory where you have installed android-sdk. Go to platform-tools folder. Paste cmd there, right click on it and in the settings, select Run as Administrator.
7. You are done. Now what to do in it?
ADB Commands
Type adb in command prompt. And several commands will show up on your screen. It is very difficult to analyse these all commands, so we will only talk about most used and important commands
Connect your device via USB cable
And open the CMD in platform-tools folder(Make a shortcut of it on desktop). And type the suitable commands
Code:
adb devices
Will show the list of devices attached to the PC andtheir serial numbers. If this shows up correctly on your PC, then it means that everything is fine for continuing.
Logcat
Code:
adb logcat
It will display the real time log of your device
Best time to do it is when your device boots up
Now, many users ask me how to copy the logcat and upload it from CMD
There are several methods:-
1. Right click on the Title Bar of Command Prompt. Hover the cursor over edit and select mark. Select all the things you want to copy and then click enter. All the things will be copied to clipboard.
2. This is the correct way of getting logcat saved.
Code:
adb logcat > logcat.txt
This command will create a logcat.txt document in platform-tools folder with the complete logcat of the device. Ofcourse you can type any name instead of logcat.txt
3. I prefer taking logcat this way as it neatly compiles logs of different time
Code:
adb logcat -v long > logcat.txt
This is a very nice way to get logcat.
Installing Apps
Code:
adb install %PATH OF APK%
This will install an app on your Android
For example, if my app AreeB.apk is in G:\ drive (G:\AreeB.apk)
Then I will type
Code:
adb install G:\AreeB.apk
Be sure your apk is not in a folder that has space in its name, else the command will break at space bar.
For eg:-
G:\Program Files\AreeB.apk
Note:
If you have spaces in path of apk, you can execute the command without breakage if you include the path inside quotes. (Thanks to etcman)
Eg:-
Code:
adb install "G:\Program Files\AreeB.apk"
Mounting
However, I never found any problem in tweaking with system files with adb, but some users said that they couldn't do it, so the problem was that their system partition was mounted as Read Only(R/O)
So, it is necessary now to tell how to mount system partition as Read Write(R/W)
Code:
adb remount
It is easiest way to do so, if it does not work then
There is another method that we will discuss in ADB Shell commands section
Pushing and Pulling
For pushing,
Type
Code:
adb push %PATH TO BE PUSHED% %PATH WHERE TO BE PUSHED%
Suppose I have an app named SystemUI.apk(PATH = G:\SystemUI.apk) which I want to push in /system/app/ on my android(or in other words, install an app as a system app). Then I would type
Code:
adb push G:\SystemUI.apk /system/app/
More examples
G:\Dance.txt file to be pushed in Dance folder in sdcard
Code:
adb push G:\Dance.txt /sdcard/Dance/
OR
Code:
adb push G:\Dance.txt /mnt/sdcard/Dance/
G:\Movies folder to be transferred in SDCARD in Videos Folder
Code:
adb push G:\Movies /sdcard/Videos/
G:\system\framework\framework-res.apk to be pushed in /system/framework/
Code:
adb push G:\system\framework\framework-res.apk /system/framework/
For pulling,
push command replaces with pull and paths are swapped
Code:
adb pull %PATH TO BE PULLED FROM% %PATH TO PLACE PULLED FILE%
Example,
All system apps are to be pulled to G:\ROM\system\app
Code:
adb pull /system/app G:\ROM\system\app\
build.prop to be extracted to desktop
Code:
adb pull /system/build.prop C:\Users\Areeb\Desktop\
However, if a folder is in platform-tools folder, you don't need to type full path
Suppose if I type
Code:
adb pull /system/ system
Then a folder named system will be created inside platform-tools with all the files in system in it
If a file is in platform-tools folder, then also no need to type full path
For example,
There is an app name DeskClock.apk in this folder then, to push it to /system/app, type
Code:
adb push DeskClock.apk /system/app/
ADB Shell Commands
This mode of adb allows you to execute linux shell commands from your PC
These commands can aldo be executed through the mobile using Terminal Emulator
To initiate shell mode
Type
Code:
adb shell
You will get an prompt like this
sh-3.2#
Now you are in shell mode
adb commands won't work here and a new set of commands will work here. But we will only go in a little detail here.
Assuming you are in adb shell mode, I will only type commands that will work on shell. Note:- These commands won't work if you type them alone on cmd. But, these command will directly work on your mobile's Terminal Emulator
As these commands can also work on mobile, I am going to tell you a way of taking logcat on mobile
Type
Code:
logcat
You will see log of your device
To save this
Type
Code:
logcat > /sdcard/log.txt
A file named log.txt will be generated in sdcard
Uninstalling Applications
Code:
cd /data/app
This will change the directory to /data/app
Code:
ls
This will show the list of files in there
Suppose, there is an app named com.opera.browser (Opera Mobile) you want to uninstall it
Type
Code:
rm -r com.opera.browser
This will uninstall the app
Mounting Command:-
Code:
mount -o rw,remount /dev/block/mtdblock3 /system
Miscellanous commands:-
su: Initiates root request
du: Shows file foldrs and size
date: Shows todays date
ls: Shows list of directory
cd: Changes working directory
rm: Removes the file
logcat: Displays logcat
mount: Mounts the partition
busybox: Busybox Applets
Forgot next ones, will write later
Credits
Google: For Android and several searchings
Samsung: For Galaxy Ace s5830I
paxChristos for amazing logcat guide
Broadcom: For their Open Sourceness
XDA Forums : For the precious knowledge
My Uncle: For gifting me this Phone
My Teachers: For teaching me English(I would not be here without them)
You: For future Thanks
Till now, thats it, will add some more things later
If any problem, I will add it too
Suggestion? They are welcome
Click to expand...
Click to collapse
This should help the new members in appealing their problems in a deeper and better way.
Originally posted by iamareebjamal
Original thread here.

Categories

Resources