Save Protected Apps to SD - G1 Android Development

MUST HAVE ROOT ACCESS!!
You can do this on your phone using Terminal Emulator
1. type "su" to turn $ into # (Superuser Whitelist will ask for root access; grant it)
2. Type 'cd data/app-private'.
3. Get a list of all the applications by typing 'ls'.
4. Pick which file you want to copy and type 'cp your_file_name.apk /sdcard/ e.g. 'cp com.android.musicplayer.apk /sdcard/'
5. Copy the .apk file off your memory card.
You can also do this using ADB, just replace step one with "adb shell" in your command prompt, and follow the rest of the steps

Why are you making it easier for people to pirate applications?

GoldenCyn said:
4. Pick which file you want to copy and type 'cp your_file_name.apk /sdcard/ e.g. 'cp com.android.musicplayer.apk /sdcard/'
Click to expand...
Click to collapse
so all copyright law violations aside you have failed to mention the fact that the file can no longer be used on a G1 or any other file structure requiring proper permissions
nevertheless .. copying of these protected apps off the G1 is most definitely illegal .. i would not recommend testing this out

Related

adb install in terminal emulator?

Some of you are familiar with the adb install command.
Is there an equivalent of it in the terminal emulator?
Hi,
Adb is used from the computer and terminal emulator is used from the phone.
What are you trying to do?
I'm trying to install an app without using astro.
your best choise would be
cd to the location of the apk file and use
adb install appname.apk
or adb install C:\folder\appname.apk
think thats the correct way im not sure how you can install it in the terminal i knwowho to remove it.. but not install :/
Install .apk via Terminal EMulator
1) Place the .apk on the root of your SD card (for simplicity)
2) Type "su"
3) cd into the destination of your .apk (in this case it will be cd /sdcard)
4) Use "install "name of .apk" /"destination"/"name of .apk"
su
cd /sdcard
install com.makemobile.coursepro.apk /system/app/com.makemobile.coursepro.apk
further example:
install "space" com.makemobile.coursepro.apk "space" /system/app/com.makemobile.coursepro.apk
This will install the app on your phone using the Terminal Emulator. The destination location can change as well.
Additional help: http://www.busybox.net/downloads/BusyBox.html
On the flip side, could you uninstall from the ext2 partition this way?
install on/from ext2
not sure...I'll looks into this. I had my apps and data on my sd however, it seemed a little buggy and inconsistant. It may have been due to using original G1 1gb class 2 card.
-let me know if you find out first.
a1t said:
1) Place the .apk on the root of your SD card (for simplicity)
2) Type "su"
3) cd into the destination of your .apk (in this case it will be cd /sdcard)
4) Use "install "name of .apk" /"destination"/"name of .apk"
su
cd /sdcard
install com.makemobile.coursepro.apk /system/app/com.makemobile.coursepro.apk
further example:
install "space" com.makemobile.coursepro.apk "space" /system/app/com.makemobile.coursepro.apk
This will install the app on your phone using the Terminal Emulator. The destination location can change as well.
Additional help: http://www.busybox.net/downloads/BusyBox.html
Click to expand...
Click to collapse
nevermind..........used astro file manager and it worked fine
help
what's 'cd' ? the emulator is already installed on the phone ?
i'm trying to install an app but i don't understand the adb method. someone can help me ?
thanks
MikeMadden said:
what's 'cd' ? the emulator is already installed on the phone ?
i'm trying to install an app but i don't understand the adb method. someone can help me ?
thanks
Click to expand...
Click to collapse
cd is a command, meaning "change directory". Which is used to move your location on the system.
MikeMadden said:
what's 'cd' ? the emulator is already installed on the phone ?
Click to expand...
Click to collapse
cd is a *nix command , it is short for 'change directory' and it... changes directory
MikeMadden said:
i'm trying to install an app but i don't understand the adb method. someone can help me ?
thanks
Click to expand...
Click to collapse
it depends on what the app is
your best bet would be to get an app called 'Astro file manager' from the market
Its quite easy, so I won't go into further detail
Which to be honest is a fair trade
APrinceAmongMen said:
Some of you are familiar with the adb install command.
Is there an equivalent of it in the terminal emulator?
Click to expand...
Click to collapse
Some people have mentioned the `install' command from BusyBox, but this won't quite do what you probably want. To invoke the full Android package installation experience--the complete equivalent of `adb install'--you're looking for `pm install'. It takes the same arguments that `adb install' does, checks signatures, creates the appropriate user accounts, etc. so the package is installed the Android way. You can also use `pm uninstall' to remove a package (and as with `adb install', the "-k" option keeps its data around).
The `am' and `pm' commands are both underdocumented, but can be terribly useful. `am' can issue arbitrary Intents, including some Extra values. `pm' has other features not mentioned here, but which are shown in the help text.
olearyp said:
Some people have mentioned the `install' command from BusyBox, but this won't quite do what you probably want. To invoke the full Android package installation experience--the complete equivalent of `adb install'--you're looking for `pm install'. It takes the same arguments that `adb install' does, checks signatures, creates the appropriate user accounts, etc. so the package is installed the Android way. You can also use `pm uninstall' to remove a package (and as with `adb install', the "-k" option keeps its data around).
The `am' and `pm' commands are both underdocumented, but can be terribly useful. `am' can issue arbitrary Intents, including some Extra values. `pm' has other features not mentioned here, but which are shown in the help text.
Click to expand...
Click to collapse
'pm install' often fails with [INSTALL_FAILED_INSUFFICIENT_STORAGE]
which used to frustrate me no end ..
simple shell script
Code:
am start -a android.intent.action.VIEW -t application/vnd.android.package-archive -d file://$1
just pass the full path e.g
sh /sdcard/installapk.sh /sdcard/theapp.apk
and it pops up the Android Package installer
Firerat said:
'pm install' often fails with [INSTALL_FAILED_INSUFFICIENT_STORAGE]
which used to frustrate me no end ..
Click to expand...
Click to collapse
Interesting. I wonder if that's related to A2SD or a particular implementation, and pm getting confused as a result? Still, I like the idea of sending the VIEW intent to bring up the package installer. Good snippet.
I just cp the files to /system/sd/app/
from Windows Command prompt, and after switching to the folder containing the .apk file, type:
adb install filename.apk
if it is a reinstall:
adb install -r filename.apk
you could also push the file to the app folder. I use this method to push system apk:
adb remount <<<< you have to remount since you're going to mess with a sys folder
adb push filename.apk /system/app
seriously useful thread... especially after for some weird reason certain apps fail to install using the default Android installer. *cough* Radiant *cough*
Thanks for the help guys. Btw install command doesn't work. To clear things out for some clueless person like I am :
1. Open Terminal Emulator
2. Type -
su
cd /dir
pm install appname.apk
3. Done!
Example -
su
cd /sdcard
pm install AstroFileManager.apk
Hope that can help!
rajasyaitan said:
Thanks for the help guys. Btw install command doesn't work. To clear things out for some clueless person like I am :
1. Open Terminal Emulator
2. Type -
su
cd /dir
pm install appname.apk
3. Done!
Hope that can help!
Click to expand...
Click to collapse
This is very helpful, thanks!
rajasyaitan said:
Thanks for the help guys. Btw install command doesn't work. To clear things out for some clueless person like I am :
1. Open Terminal Emulator
2. Type -
su
cd /dir
pm install appname.apk
3. Done!
Example -
su
cd /sdcard
pm install AstroFileManager.apk
Hope that can help!
Click to expand...
Click to collapse
Thanks big time. Installed perfectly although apk won't open...just got to find one that will.

Idea for a very usefull app. Dev's needed

Hello all.
By flashing my device many times, I am always fed up to plug it and remove all the application I don't want, or open the zip file, remove the apk and resign the ROM.
What I have in mind is making a little app that show us all the applications in system/app ( easy) and them when clicking on them just like a adb shell rm system/app/myUnwantedApp.apk.
The browser is easy to program, but the command line is not easy. I tried with eStrongs and Astro, but they cannot remove the apk..
Cam someone help me or teach me how to enter a adb command line in my phone?
Thank a lot.
profete162 said:
Hello all.
By flashing my device many times, I am always fed up to plug it and remove all the application I don't want, or open the zip file, remove the apk and resign the ROM.
What I have in mind is making a little app that show us all the applications in system/app ( easy) and them when clicking on them just like a adb shell rm system/app/myUnwantedApp.apk.
The browser is easy to program, but the command line is not easy. I tried with eStrongs and Astro, but they cannot remove the apk..
Cam someone help me or teach me how to enter a adb command line in my phone?
Thank a lot.
Click to expand...
Click to collapse
You can use a terminal emulator application like Better Term etc to run shell commands. There is nothing special about adb.
The command adb shell rm is simply running the shell first and then the "rm" command. Now, depending upon the ROM that you are using, the command adb shell will give you a root shell (or not). In any case, when you use a terminal emulator, simply use the "su" command to gain super user privileges (you have to have "su" and SuperUser.apk installed).
Since you are talking about a custom ROM, I think that root access is implied.
In any case, look at programs like Android Scripting Environment. It allows you to code scripts in an interpreted language like shell script, python etc... In your case simply write a shell script with the desired "rm ...." commands and execute them after gaining superuser permissions and make sure that your /system partition is mounted in rw mode.

[Q] NEED HELP LG Optimus Elite Virgin Mobile

Hello Forum!
So i am currently using a Virgin Mobile LG Optimus Elite.
After 2 days of refuge here on the forums i amazingly found a small little program that was intended to root p500 devices and worked for mine.
I did run root checker and all plus i have root access so it is rooted.
My problem is,
1.) I cannot edit my build.prop
2.) Install Xbox Smartglass (which is the whole reason i'm killing myself for all this right now)
I'm running 2.3.7 gingerbread, and the smartglass app requires 4.0 and up.
I am certain this phone can run the app.
From the very beginning i tried to take the easy path out by manually downloading the .apk from an outside source but when i try to install it
i get an error stating that it had a problem "parsing" the info.
Running my little research i found you could edit the build.prop file to make the play store think you were running another device that was compatible. Then realizing my device must be rooted first, began my 2 days long journey to root the stubborn thing.
After root success, I installed ES File Explorer. From there, i went to my build.prop, proceeded to edit it with the ES text editor. Re-wrote the 2 lines required then when i went to save, "Error occurred when trying to save the file. It will not be saved." And just left me hanging after that.
In a quick desperate attempt, i found QtADB, which i thought would allow me to edit the system files. It only allowed me access to a hand full of the root directories. I downloaded the newest android dev kit (obviously you need it to run QtADB) so i don't know what exactly the problem here is.
For my absolute last desperate attempt i decided to do it manually. I took the build.prop and edited it manually through wordpad. (NOTE: i backed up the original) I named it "copy.build.prop" and placed it back in an easy to find directory. I then opened up ES file explorer, located the file and tried to copy it to the original location but no matter what i name it or what i do in general it will not move. It keeps failing and just telling me the file cannot be moved.
I am at my last legs with this to the point where i may just give up.
I dont know what to do and was hoping someone on here would.
If there was another way to install the app? If i could install it manually? Something to get me around all these utterly frustrating and annoying errors. I've ran from error to error, fixing it then coming to another. And at this point i just dont know what to do.
The help and replies would be much appreciated! Thanks in advanced!
The build.prop file is located in the /system partition, which is by default mounted as read-only (and for good reason).
Here are some simple steps to modifying the build.prop file.
1) Fire up an ADB shell ("adb shell" from a command prompt without quotes)
2) Within the ADB shell, execute "mount -o rw,remount /system /system" without quotes. This will remount your /system partition in read-write mode
3) Open a new command prompt and CD to an easily accessible directory (e.g "cd ~/Desktop" if on a Linux box)
4) Execute "adb pull /system/build.prop" without quotes
5) Edit the build.prop file as needed with a good text editor (DO NOT use Wordpad or Notepad, I prefer Notepad++ on Windows and Geany on Linux)
6) Execute "adb push /path/to/your/edited/build.prop /system/build.prop" without quotes. This will copy your modified build.prop back into the /system partition
7) In the ADB shell prompt, execute "mount -o ro,remount /system /system" without quotes. This will remount your /system partition read-only (never leave it read-write that is bad)
8) Reboot your phone
9) Profit!
As far as the Smartglass app goes, there is likely a good reason it requires ICS and above, and simply modifying your build.prop may not be enough. Don't take my word for it though, try the above steps and see what happens.
Cheers!
drewwalton19216801 said:
The build.prop file is located in the /system partition, which is by default mounted as read-only (and for good reason).
Here are some simple steps to modifying the build.prop file.
1) Fire up an ADB shell ("adb shell" from a command prompt without quotes)
2) Within the ADB shell, execute "mount -o rw,remount /system /system" without quotes. This will remount your /system partition in read-write mode
3) Open a new command prompt and CD to an easily accessible directory (e.g "cd ~/Desktop" if on a Linux box)
4) Execute "adb pull /system/build.prop" without quotes
5) Edit the build.prop file as needed with a good text editor (DO NOT use Wordpad or Notepad, I prefer Notepad++ on Windows and Geany on Linux)
6) Execute "adb push /path/to/your/edited/build.prop /system/build.prop" without quotes. This will copy your modified build.prop back into the /system partition
7) In the ADB shell prompt, execute "mount -o ro,remount /system /system" without quotes. This will remount your /system partition read-only (never leave it read-write that is bad)
8) Reboot your phone
9) Profit!
As far as the Smartglass app goes, there is likely a good reason it requires ICS and above, and simply modifying your build.prop may not be enough. Don't take my word for it though, try the above steps and see what happens.
Cheers!
Click to expand...
Click to collapse
I'm having problems setting a custom directory now... im on a windows 7 pc. I'm using the Qtabd shell, and at first it stated to give the CD a home, i've tried a million combinations and i just cant get one to work!!!

[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