ADB Uninstall Failure - Android Software/Hacking General [Developers Only]

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

Related

Safe Apps to Remove - Root Access + custom Recovery Required

I thought I would provide information that I've been compiling and will continue to compile on which apps are safe to remove. I'm going to be testing what other apps can be removed. I suggest pulling your entire app directory before you start removing apps as well as doing a nandroid backup first. I've attached a bat file for windows users.
To mount \system folder:
1. Reboot into recovery mode ( power device down then hold power button + volume -)
2. choose partitions
3. choose mount \system
NOTE: Remove Facebook account from device before remove friendstream widget. Do not remove Friendstream.apk
Code:
adb shell /system/bin/rm /system/app/com.htc.TwitterWidget.*
adb shell /system/bin/rm /system/app/HtcTwitter.*
adb shell /system/bin/rm /system/app/HtcFootprintsWidget.*
adb shell /system/bin/rm /system/app/HtcFootprints.*
adb shell /system/bin/rm /system/app/Stock.*
adb shell /system/bin/rm /system/app/com.htc.StockWidget.*
adb shell /system/bin/rm /system/app/VVM.*
adb shell /system/bin/rm /system/app/Quickoffice.*
adb shell /system/bin/rm /system/app/PDFViewer.*
adb shell /system/bin/rm /system/app/Calculator.*
adb shell /system/bin/rm /system/app/Mail.*
adb shell /system/bin/rm /system/app/htcmailwidgets.*
adb shell /system/bin/rm /system/app/htcmsgwidgets.*
adb shell /system/bin/rm /system/app/HtcRingtoneTrimmer.*
adb shell /system/bin/rm /system/app/Flickr.*
adb shell /system/bin/rm /system/app/CityID.*
adb shell /system/bin/rm /system/app/com.htc.FriendStreamWidget.*
I updated this post with the recovery directory. Just unzip to root of C: drive and run the bat file and it should push all the removed apps back to your device. You must be in recovery mode to do this and you must mount \system directory as well.
Change log
removal_V2.zip
-removed the removal of frienstream.apk
Restore_V2.zip
-First Restore batch file was incorrect. If you downloaded restore_v1 replace with restore_V2
Very nice, just what I've been waiting for.
Thanks!
Talking from previous experience I wouldnt just remove the apps unless you first have a backup to restore from. It is safer to just mv example.apk example.apkback then to rm the apk.
Also when removing VVM.apk I saw on Killa200 that it did something with the sms apk.
Here is killa200's findings so far.
http://bluraynetworks.com/android/
zerf said:
Talking from previous experience I wouldnt just remove the apps unless you first have a backup to restore from. It is safer to just mv example.apk example.apkback then to rm the apk.
Also when removing VVM.apk I saw on Killa200 that it did something with the sms apk.
Here is killa200's findings so far.
http://bluraynetworks.com/android/
Click to expand...
Click to collapse
I 100% agree. Although i was never able to get the mv to work so i just pulled all apps to my desktop and then i push them back if i need to restore them.
Worked great Thanks. I just edited the file for the ones I wanted to keep and then ran the .bat while in recovery.
zerf said:
Here is killa200's findings so far.
http://bluraynetworks.com/android/
Click to expand...
Click to collapse
Excellent list as well. I'm not sure about VVM.apk. I removed it and i still have the htc messaging app. I don't use that message app but its still there and opens just fine.
Bxsteez said:
I thought I would provide information that I've been compiling and will continue to compile on which apps are safe to remove. I'm going to be testing what other apps can be removed. I suggest pulling your entire app directory before you start removing apps as well as doing a nandroid backup first. I've attached a bat file for windows users.
NOTE: Remove Facebook account from device before remove friendstream.
Code:
adb shell /system/bin/rm /system/app/com.htc.TwitterWidget.*
adb shell /system/bin/rm /system/app/HtcTwitter.*
adb shell /system/bin/rm /system/app/HtcFootprintsWidget.*
adb shell /system/bin/rm /system/app/HtcFootprints.*
adb shell /system/bin/rm /system/app/Stock.*
adb shell /system/bin/rm /system/app/com.htc.StockWidget.*
adb shell /system/bin/rm /system/app/VVM.*
adb shell /system/bin/rm /system/app/Quickoffice.*
adb shell /system/bin/rm /system/app/PDFViewer.*
adb shell /system/bin/rm /system/app/Calculator.*
adb shell /system/bin/rm /system/app/Mail.*
adb shell /system/bin/rm /system/app/htcmailwidgets.*
adb shell /system/bin/rm /system/app/htcmsgwidgets.*
adb shell /system/bin/rm /system/app/HtcRingtoneTrimmer.*
adb shell /system/bin/rm /system/app/Flickr.*
adb shell /system/bin/rm /system/app/CityID.*
adb shell /system/bin/rm /system/app/FriendStream.*
adb shell /system/bin/rm /system/app/com.htc.FriendStreamWidget.*
I updated this post with the recovery directory. Just unzip to root of C: drive and run the bat file and it should push all the removed apps back to your device. You must be in recovery mode to do this and you must mount \system directory as well.
Click to expand...
Click to collapse
For us noobs, what is the command to mount the /system directory?
you mount it with the recovery on the phone.. click partitions on the custom recovery
WhammyDroid said:
For us noobs, what is the command to mount the /system directory?
Click to expand...
Click to collapse
yojoe600 said:
you mount it with the recovery on the phone.. click partitions on the custom recovery
Click to expand...
Click to collapse
Added mounting information to first post. I'm a NOOB to android as well
I noticed i kept seeing the syncing notification even though nothing was actually syncing so i pushed friendstream(See recovery.bat) back onto the device and that seemed to fix it.
I also removed the Teeter game without any issues using the following:
/system/bin/rm /system/app/teeter.*
Is it just me or is the
adb shell /system/bin/rm /system/app/VVM.*
not working?
No such file or directory everytime =/ and the icon is still on my phone...also want to remove the messaging application. I don't even use messaging
Thanks man i removed a couple apps that bothered me.
Sent from my Droid Incredible
0mie said:
Is it just me or is the
adb shell /system/bin/rm /system/app/VVM.*
not working?
No such file or directory everytime =/ and the icon is still on my phone...also want to remove the messaging application. I don't even use messaging
Click to expand...
Click to collapse
I do not think you can remove the text messaging app. I'm not sure else besides never being able to text will happen. the VVM should remove just fine. Do an " cd /system/app" and then an "ls " and make sure its present. Also son't forget to mount /system
.
havent used it but may later thanks
Can I delete files in the Backup folder of the Restore and then run restore so it will just put back the apps that i want?
GooTz66 said:
Can I delete files in the Backup folder of the Restore and then run restore so it will just put back the apps that i want?
Click to expand...
Click to collapse
sure. It will just error when it hits the push command for that file. What i would recommend is to delete the commands from restore.bat that restore the programs you don't want to restore. Then you will have the backups on ur computer just in case u ever decide to remove them.
Bxsteez said:
sure. It will just error when it hits the push command for that file. What i would recommend is to delete the commands from restore.bat that restore the programs you don't want to restore. Then you will have the backups on ur computer just in case u ever decide to remove them.
Click to expand...
Click to collapse
Awesome. Thanks!
Question regarding FB/FriendStream. So if I remove my FB for HTC Sense then delete FriendStream and re-add my FB account will it work normally or will it still hangup when it trys to sync.
GooTz66 said:
Question regarding FB/FriendStream. So if I remove my FB for HTC Sense then delete FriendStream and re-add my FB account will it work normally or will it still hangup when it trys to sync.
Click to expand...
Click to collapse
Actually you have to keep the friendstream.apk. I didn't have sync issues but i did have a sync icon preset all the time. Others have reported sync issues.

sh: can't open installbusybox.sh

Follwing this to install ubuntu:
http://trsohmers.com/2011/03/06/how-to-run-ubuntu-on-the-motorola-xoom/
But I get the message sh: can't open installbusybox.sh
Everything was fine up until that moment, can you help me?
You sure you're in the correct directory? According to the guide (if you're following it step by step) it should be on /sdcard, so when you go into the shell, the next command would be cd /sdcard to make sure you're in there then you can run sh installbusybox.sh
Yeah, after I do adb shell, su, cd /sdcard
Also, adb push doesn't seem to work so I had to manually put them in the SD card. It gives me an error when I try to push.
Usually the correct way to do a "push" would be to use adb push filename.ext /sdcard/ (making sure you put down the last slash to let it know you're pushing it to a directory, I tend to find it give me an error elsewise).
Another thing you can try to do is type sh ./busyboxinstaller.sh, see if that makes any differences.
The push works now with the other slash, but with the sh command, I get this error now:
mkdir: can't create directory '/system/xbin':file exists
Okay, I got STEP TWO: Installing Ubuntu. I had to install busybox from the market. Then, I can't cd to the /sdcard/ubuntu It says cd: can't cd to /sdcard/ubuntu

[Q] How to unroot phone Atrix 2

I used the eacy one click to root phone. I would like to unroot it now. I am having touch screen freezing problem. I need to start removing applications to see which one is causing the problem or if it is a hardware issue or software.
I downloaded the zip file 1-click_exploit. I expanded the files and ran the application. I have read that there is an option to uninstall with in that file but I don't see one. Where do I find it. If I just do a factory reset will it remove it? If I do a reset do I have to repurchase all of my apps?
Thank you in advance!
A factory data reset will not remove root.
Also, a reset does not delete your purchases. They are all stored in your google account. So, if they do get deleted, just reinstall them.
As far as unrooting, I do not know. Someone else may chime in here...probably going to tell you to post in the Q&A section as well.
Doesn't the one-click have an un-root feature?
Sent from my bootloader-locked MB865.
The one click method also has an un root option in the folder.
Sent from my MB865 using xda app-developers app
Generally the only trace rooting leaves is a setuid binary "su" in /system/bin. And Superuser.apk to manage permission which apps get to invoke the binary. So unrooting involves uninstalling Superuser application and removing the su binary. If you want to do it by hand: (1) adb remount (2) adb shell (3) su (4) rm /system/bin/su
kousik said:
Generally the only trace rooting leaves is a setuid binary "su" in /system/bin. And Superuser.apk to manage permission which apps get to invoke the binary. So unrooting involves uninstalling Superuser application and removing the su binary. If you want to do it by hand: (1) adb remount (2) adb shell (3) su (4) rm /system/bin/su
Click to expand...
Click to collapse
I have no idea what the above manual steps are for. I can uninstall the application but where and how do I remove the su binary. On the phone? Please send directions for a non technical type of user.
Thank you!
MaTrixJ said:
The one click method also has an un root option in the folder.
Sent from my MB865 using xda app-developers app
Click to expand...
Click to collapse
Not sure where in the the following files in 1-click_exploit is the unroot option.I have attached a list of the files in the download.
bushbaum said:
Not sure where in the the following files in 1-click_exploit is the unroot option.I have attached a list of the files in the download.
Click to expand...
Click to collapse
Out of these files, adb.exe and .dll files are left in your windows PC. Not sure if they are deleted afterwards, if not, you can always unzip the above into a directory. You'll need the adb and the dll files.
The su and superuser.apk are two files that are pushed to your phone that provides the root functionality.
The zerg file is the exploit payload temporarily used to root your phone, and removed later by the script.
So if you have unzipped these into a directory, connect your phone via USB (make sure usb debugging is on), and run the commands
Code:
adb.exe remount
adb.exe shell
su // superuser may pop a permission request on phone screen
rm /system/bin/su
rm /system/app/Superuser.apk
exit
kousik said:
Out of these files, adb.exe and .dll files are left in your windows PC. Not sure if they are deleted afterwards, if not, you can always unzip the above into a directory. You'll need the adb and the dll files.
The su and superuser.apk are two files that are pushed to your phone that provides the root functionality.
The zerg file is the exploit payload temporarily used to root your phone, and removed later by the script.
So if you have unzipped these into a directory, connect your phone via USB (make sure usb debugging is on), and run the commands
Code:
adb.exe remount
adb.exe shell
su // superuser may pop a permission request on phone screen
rm /system/bin/wu
rm /system/app/Superuser.apk
exit
Click to expand...
Click to collapse
What mode is my usb connection? charge only? I have the phone setting usb setting on. I run the commands (using the run command in windows accessories). When I go run "adb.exe remount" the black command screen blinks on screen so then under I go to run again and entered "adb.exe shell" the run command screen opens up with [email protected]:/$ I put in "su" After I entered the command rm system/bin/wu I get a "read only error" how do I change from read only?
Sorry for all these questions but I warned you that I was not a technical user. Thanks
bushbaum said:
What mode is my usb connection? charge only? I have the phone setting usb setting on. I run the commands (using the run command in windows accessories). When I go run "adb.exe remount" the black command screen blinks on screen so then under I go to run again and entered "adb.exe shell" the run command screen opens up with [email protected]:/$ I put in "su" After I entered the command rm system/bin/wu I get a "read only error" how do I change from read only?
Sorry for all these questions but I warned you that I was not a technical user. Thanks
Click to expand...
Click to collapse
I was wondering do I have to have the elite version superuser installed to grant permission to system? I just have the free version.
bushbaum said:
What mode is my usb connection? charge only? I have the phone setting usb setting on. I run the commands (using the run command in windows accessories). When I go run "adb.exe remount" the black command screen blinks on screen so then under I go to run again and entered "adb.exe shell" the run command screen opens up with [email protected]:/$ I put in "su" After I entered the command rm system/bin/wu I get a "read only error" how do I change from read only?
Click to expand...
Click to collapse
1. yes -- charge only
2. it is better to open a command prompt -- in run commands type in "cmd" which'll give you a shell, easy to track command outputs
3. in that shell cd to the directory you unzipped and run "adb.exe remount"
4. Unless it says "remount succeeded" further operations won't succeed
5. After you execute "su" your prompt will change from $ to # ... is this happening?
6. Only on # prompt, you can do "rm /system/bin/su" ... that too only if remount succeeded
Let us know at which step it fails.
kousik said:
1. yes -- charge only
2. it is better to open a command prompt -- in run commands type in "cmd" which'll give you a shell, easy to track command outputs
3. in that shell cd to the directory you unzipped and run "adb.exe remount"
4. Unless it says "remount succeeded" further operations won't succeed
5. After you execute "su" your prompt will change from $ to # ... is this happening?
6. Only on # prompt, you can do "rm /system/bin/su" ... that too only if remount succeeded
Let us know at which step it fails.
Click to expand...
Click to collapse
I get the following error after entering the run "adb.exe remount"
*daemon not running starting it now*
*daemon started successfully*
remount failed: operation not permitted
bushbaum said:
I get the following error after entering the run "adb.exe remount"
*daemon not running starting it now*
*daemon started successfully*
remount failed: operation not permitted
Click to expand...
Click to collapse
Then try remounting manually:
Code:
C:\> adb.exe shell
edison$/ su
edison#/ mount -o remount,rw /dev/block/system /system
Afterwards proceed with rest of the script.

[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