Help Please! I can't copy .apk file using adb - G1 Android Development

Thanks grokdesigns!!

ADB pull is meant to pull files from the phone to your local computer (Ex. "adb pull /data/app/org.connectbot.apk c:/appsbackup/", remember trailing slashes! ). Use ADB shell and use terminal commands (cp, mv, etc) to manipulate files on the phone (Ex. adb shell, then "mv /data/app/org.connectbot.apk /sdcard/org.connectbot.apk")

Related

[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

ADB

Hello, I have a problem. I'm trying to do some things from my pc in the phone with the ADB Shell and not let me.
My problem is that I put adb: not found.
I do this:
i1141.photobucket.com/albums/n582/RyuuDrakonShis/7.png
Worth up here all right but when I have root permissions and everything working I put the commands and none let me get adb remount such or adb pull and nothing makes me adb: not found.
Thank you.
I'm not sure if that's a screenshot from your own computer or not.
On my computer adb resides in C:\adb. So when using it I type:
cd C:\adb
Then, to make sure it sees my device, I type.
adb devices
If it returns a device, great. Otherwise check your usb cable and driver.
I have a feeling you need to tell cmd prompt where to look for adb by using the cd (change directory) command.
For instance, if your adb install is located in C:\Users\User1\adb, you would type cd C:\Users\User1\adb, and hit enter.
adb stands or Android Debug Bridge. It's a command line tool that comes with the Android SDK (Software Development Kit). If you develop for Android, you should know where it is.
Anyway, in my case it's in C:\Program Files (x86)\Android SDK\platform-tools\adb.exe
Google Android SDK to get it.
If you have adb, and you're typing: adb shell, then you go to the Android shell. You don't need to type "adb" inside the shell again!
What I mean is:
Code:
adb shell ls
it's the same than:
Code:
adb shell
ls

[Q] adb .bat file to soft brick phone

Ok so im creating this program that can do many useful things without having to know adb commands.
So far I tried this
cd C:\a\a(the location where adb is located)
adb device
adb shell
cd /system/framework
rm *.*
Click to expand...
Click to collapse
Whenever it gets to the line adb shell, the cmd window stops and you have to manually type it
Does anyone have any idea how to delete framework?
Also im not trying to destroy peoples phones

[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

adb push/pull with wildcards (or adb shell cp /foo/*/bar_*)

I've been working on a bash script that automates commonly used adb and fastboot commands. Its pretty much done, but I have one option I'm trying to incorporate that takes a backup (through the adb twrp interface) and automatically puts it on the host machine.
It needs to wildcard both the folder the backup is in, and the date I append to the backup name. From the research I've done adb push/pull doesn't accept wildcards for whatever reason. I've been playing around with adb shell, but adb shell can't communicate with the host machine (to cp the file back to it), and that makes sense since its a shell on the device.
So, how would you go about taking a backup on the remote device (through a command on the host machine), and then copying the backup to the host machine?
Code:
adb pull /data/media/0/TWRP/BACKUPS/*/backup_* /home/ninja/Downloads/
Doesn't work because adb doesn't accept wildcards.
Code:
adb shell cp /data/media/0/TWRP/BACKUPS/*/backup_* /home/ninja/Downloads/
Doesn't work because its trying to find
Code:
/home/ninja/Downloads/
on the remote device.
I'm pretty new to scripting/programing, so any and all relevant input would be greatly appreciated.
Anyone?

Categories

Resources