For a lot of us, the fact that we can is a big plus. Besides the times when we've broken something and need to fix it, there are plenty of reasons why an advanced Android user would want to talk to his or her device. To do that, you need to have a few tools and know a few commands. Hymnal 1982 pdf download. That's what we're going to talk about today. Granted, this won't be the end-all be-all discussion of adb commands, but there are 10 basic commands everyone should know if they plan to get down and dirty with the command line.
![]()
The tools are easy. If you're a Mac or Linux user, you'll want to install the SDK as explained. It's not hard, and you don't have the whole driver mess that Windows users do.
Follow the directions and get things set up while I talk to the Windows using folks for a minute. If you're using Windows, things are easier and harder at the same time.
Are the easy part. Open the zip file and you'll see a folder named android-tools. Drag that folder somewhere easy to get to. Next, visit the manufacturers page for your device and install the adb and fastboot drivers for Windows.
You'll need this so that your computer can talk to your Android device. If you hit a snag, visit the forums and somebody is bound to be able to help you through it.
Now that we're all on the same page, enable USB debugging on your device (see your devices manual if you need help finding it, and remember it was ), and plug it in to your computer. Now skip past the break and let's begin! The adb devices command The adb devices command is the most important one of the bunch, as it's what is used to make sure your computer and Android device are communicating. That's why we're covering it first.
If you're a pro at the operating system on your computer, you'll want to add the directory with the Android tools to your path. If you're not, no worries. Just start up your terminal or command console and point it at the folder with the tools in it. This will be you downloaded earlier if you use Windows, or the platform-tools folder in the fully installed Android SDK. Windows users have another easy shortcut here, and can simply Shift + right click on the folder itself to open a console in the right spot.
Mac and Linux users need to navigate there once the terminal is open, or install an extension for your file manager to do the same right click magic that's in Windows by default. Once you're sure that you are in the right folder, type ' adb devices' (without the quotes) at the command prompt. If you get a serial number, you're good to go! If you don't, make sure you're in the right folder and that you have the device driver installed correctly if you're using Windows.
And be sure you have USB debugging turned on! Now that we have everything set up, let's look at a few more commands. If you want to move a file onto your Android device programmatically, you want to use the adb pushcommand. You'll need to know a few parameters, namely the full path of the file you're pushing, and the full path to where you want to put it. Let's practice by placing a short video (in my case it's a poorly done cover of the Rick James tune Superfreak) into the Movies folder on your device storage. I copied the superfreak.mp4 file into the android-tools folder so I didn't need to type out a long path to my desktop. I suggest you do the same.
I jumped back to the command line and typed ' adb push superfreak.mp4 /sdcard/Movies/' and the file copied itself to my Nexus 4, right in the Movies folder. If I hadn't dropped the file into my tools folder, I would have had to specify the full path to it - something like C: Users Jerry Desktop superfreak.mp4. Cara mengunci folder di windows 7. Either way works, but it's always easier to just drop the file into your tools folder and save the typing. You also have to specify the full path on your device where you want the file to go. Use any of the popular Android file explorer apps from Google Play to find this. Windows users need to remember that on Android, you use forward slashes (one of these - / ) to switch folders because it's Linux. The adb pull command If adb push sends files to your Android device, it stands to reason the adb pull command gets them out.
That's exactly what it does, and it works the same way as the adb push command did. You need to know both the path of the file you want to pull off, as well as the path you want it placed into. You can leave the destination path blank and it will drop the file into your tools folder to make things easy.
In this example, I did it the hard way so you can see what it looks like. The path of the file on the device is '/sdcard/Movies/ superfreak.mp4' and I put it on my Windows 8 desktop at 'C: Users Jerry Desktop'. Again, the easy way it to just let it drop into your tools folder by not giving a destination, which would have been ' adb pull /sdcard/Movies/ superfreak.mp4'. Remember your forwards slash for the Android side, and you'll have no problems here. The adb reboot command This is exactly what you think it is - a way to reboot your device from the command line.
Running it is simple, just type ' adb reboot' and enter. Before you say 'I can just push the button!'
You have to understand that these commands can be scripted, and your device can reboot in the middle of a script if you need it to. And it's a good segue to number five. The adb reboot-bootloader and adb reboot recovery commands Not only can you reboot your device, you can specify that it reboots to the bootloader. This is awfully handy, as sometimes those button combos are touchy, and if you have a lot of devices you can never remember them all. Some devices (the LG Optimus Black comes to mind) don't even a way to boot to the bootloader without this command. And once again, being able to use this command in a script is priceless.
Doing it is easy, just type ' adb reboot-bootloader' and hit the enter key. Most devices can also boot to the recovery directly with the ' adb reboot recovery' (note there is no hyphen in this one) and some can't.
It won't hurt anything to try, and if yours can't nothing will happen. The fastboot devices command When you're working in the bootloader, adb no longer works. You're not yet booted into Android, and the debugging tools aren't active to communicate with. We use the fastboot command in it's place. Fastboot is probably the most powerful tool available, and many devices don't have it enabled. If you're does, you need to be sure things are communicating. That's where the fastboot devices command comes into play.
![]()
At the prompt, just type in ' fastboot devices' and you should see a serial number, just like the adb devices command we looked at earlier. If things aren't working and you are using Windows, you likely have a driver issue. Hit those forums for the answer. The fastboot oem unlock command The holy grail of Android commands, fastboot oem unlock does one thing, and one thing only - unlocks your Nexus device (or an HTC device using their official tool). If you're using a phone from a different manufacturer, you have a different method of unlocking things - maybe with ODIN or.sbf files - and this won't apply to you.
We're including it because even if you don't need it, it's an important part of Android's openness. Google doesn't care what we do with phones or tablets that we've bought, and include this easy way to crack them open. That's something you usually don't see from any tech company, and a big part of the reason why many of us choose Android. Using it is easy enough. Once you've used fastboot devices to make sure everything is communicating, just type ' fastboot oem unlock' at the prompt and hit enter. Look at your device, read carefully, and choose wisely.
Protip: Using 'fastboot oem unlock' will erase everything on your device 8. The adb shell command The adb shell command confuses a lot of folks. There are two ways to use it, one where you send a command to the device to run in its own command line shell, and one where you actually enter the device's command shell from your terminal. In the image above, I'm inside the device shell, listing the flies and folders on the device. Getting there is easy enough, just type ' adb shell' and enter.
Once inside, you can escalate yourself to root if you need to. I'll warn you, unless you're familiar with an ash or bash shell, you need to be careful here - especially if you're root.
Things can turn south quickly if you're not careful. If you're not familiar, ash and bash are command shells that a lot of folks use on their Linux or Mac computers.
It's nothing like DOS. The other method of using the adb shell command is in conjunction with one of those Ash commands your Android device can run. You'll often use it for more advanced tasks like changing permissions of files or folders, or running a script. Using it is easy - 'adb shell '. An example would be changing permissions on a file like so: ' adb shell chmod 666 /data/somefile'.
As mentioned, be very careful running direct commands using these methods. The adb install command While can copy files to our Android devices, adb install can actually install.apk files. Using it is similar to use the push command, because we need to provide the path to the file we're installing. That means it's always easier to just drop the app you're installing into your tools folder.
Once you've got that path, you tell your device to it like this: ' adb install TheAppName.apk'. If you're updating an app, you use the -r switch: ' adb install -r TheAppName.apk'. There is also a -sswitch which tries to install on the SD card if your ROM supports it, and the -l switch will forward lock the app (install it to /data/app-private). There are also some very advanced encryption switches, but those are best left for another article. And finally, you can uninstall apps by their package name with ' adb uninstall TheAppName.apk'. Uninstall has a switch, too.
The -k switch will uninstall the app but leave all the app data and cache in place. The adb logcat command The adb logcat command is one of the most useful commands for some folks, but just prints a bunch of gibberish unless you understand what you're seeing. It returns the events written to the various logs in the running Android system, providing invaluable information for app developers and system debuggers. Most of us will only run this one when asked by one of those developers, but it's very important that we know how to use it correctly. To see the log output on your computer screen, just type ' adb logcat' and hit enter. Things can scroll by pretty fast, and chances are you won't find what you're looking for. There are two ways to handle this one - filters, or text output.
The filter switch is used when a developer has placed a tag in his or her application, and wants to see what the event logs are saying about it. If it's needed, the developer will tell you what tag to append to the command. The text output is more useful, as it logs to a.txt file on your computer for reading later. Evoke is like so: ' adb logcat filename.txt'. Let it run while you're doing whatever it takes to crash the app or system program you're debugging, then close it with the CTRL+C keystroke. You'll find the full log file saved in the directory you're working from, likely your tools folder.
This is what you'll send to the developer. Be warned that sensitive information can be contained in the log files.
Find Serial Number Android Phone
Be sure you trust the person you're sending them to, or open the log file in a text editor and see just what you're sending and edit as necessary. There are plenty of other switches for the logcat command. Savvy developers can choose between the main, event, or radio logs, save and rotate log files on the device or their computer, and even change the verbosity of the log entries.
These methods are a bit more advanced, and anyone interested should read the Android developer documentation. Bonus: The adb sideload command This one's relatively new, and it's one of the easier ways to update a stock Nexus device.
Every over-the-air update downloads the update file from a public URL. That means you can download the update and install it manually without having to wait for your phone to have the update pushed to it.
We call it 'manually updating,' and the end result is the same as if you wait. But we hate waiting. All you have to do is download the update to your computer. Plug your phone into the computer. Reboot into recovery on your phone and choose 'Apply update from ADB.' Then hop into your favorite terminal/command line and type 'adb sideload xxxxxxxx.zip,' with the variable pointing to the update you downloaded. Let things run their course, and you're golden.
And there you have it. There are plenty more commands to learn if you 're the type who likes to learn commands, but these 10 are the ones you really need to know if you if you want to start digging around at the command prompt.
This was purely experimental for me, but it worked. And now I have my serial number back. Pre-requisites: 1.
You need CWM, running internal, or at least two microSD cards to be running from sd card. Two MicroSD card required. If you're using Windows you need some program that can perform disk dumps.
I use Ubuntu. I don't know if the commands are similar in windows, sorry. You'll need someone else' serial number.
In other words, you'll need someone else' backup of the /rom partition. Check lavero.burgos unbrick topic. I think there is one on there. This should be at least somewhat risk-free. Since it doesn't actually tinker with settings Okay, so boot into internal cwm on your Nook. Make sure you have an sdcard in your nook. Then run adb.
Code: $ dd if=/path/to/file/mmcblk0p5.img of=/dev/mmcblk0Wait for it to finish, shouldn't take longer than a half-minute, once it's done, Go ahead and mount it again, you should see the only partition as 'rom', and two folders: devconf, and log. Navigate to devconf, and there's a bunch of other files. Open 'DeviceID' in vim or notepad or something. This is your Serial No., or where it should be anyway. On your nook, if you pop open the little MicroSD flap, you will see the device' serial number. Delete whats in that file, and type your Serial No.
Close and don't forget to save it. Now open 'SerialNumber' and delete what's on there, and key in YOUR serial number.
Close and save. Umount your sdcard again. Delete the original mmcblk0p5 (/path/to/file/mmcblk0p5). Then jump into shell.
Code: $ dd if=/dev/mmcblk0 of=/path/to/file/mmcblk0p5 $ adb push /path/to/file/mmcblk0p5 /sdcard/blk $ adb shell # dd if=/sdcard/blk/mmcblk0p5 of=/dev/block/mmcblk0p5 # umount /sdcard # exitIn cwm go into advanced/reboot recovery. Let it reboot. And then when it's in cwm run 'adb devices' and verify your serial number is there.
Thanks to Pete1612 and lavero.burgos! Hopefully Pete1612 will test out this method too. This should be relatively easy, it's not hard. Just time consuming. Once again, let me know if I made any mistake.
Adb Server adb kill-server adb start-server Adb Reboot adb reboot adb reboot recovery adb reboot-bootloader Shell adb shell // Open or run commands in a terminal on the host Android device. Devices adb usb adb devices //show devices attached adb connect ipaddressofdevice Get device android version adb shell getprop ro.build.version.release LogCat adb logcat adb logcat -c // clear // The parameter -c will clear the current logs on the device.
Adb logcat -d pathtofile // Save the logcat output to a file on the local system. Adb bugreport pathtofile // Will dump the whole device information like dumpstate, dumpsys and logcat output. Files adb push source destination // Copy files from your computer to your phone. 2 player y8. Adb pull device file location local file location // Copy files from your phone to your computer. App install adb -e install path/to/app.apk -d - directs command to the only connected USB device.e - directs command to the only running emulator.
The flag you decide to use has to come before the actual adb command: adb devices tail -n +2 cut -sf 1 xargs -IX adb -s X install -r com.myAppPackage // Install the given app on all connected devices. Uninstalling app from device adb uninstall com.myAppPackage adb uninstall adb uninstall -k - 'Uninstall.apk withour deleting data' adb shell pm uninstall com.example.MyApp adb shell pm clear package // Deletes all data associated with a package. Adb devices tail -n +2 cut -sf 1 xargs -IX adb -s X uninstall com.myAppPackage //Uninstall the given app from all connected devices Update app adb install -r yourApp.apk // -r means re-install the app and keep its data on the device.
I have two smart phones ( ZTEV788d, system Android 2.3.6) connected to a computer ( Unbuntu 11.10) at the same time, using command: adb devices I got this: List of devices attached P753A12D device P753A12D device The serial numbers are the same! I wrote an application in the computer side to communicate with these two phones, for example install app and push files. I used these commands: adb -s P753A12D install XXX.apk adb -s P753A12D push XXX /sdcard Now these two phones have the same serial no ( P753A12D), when I run these commands I get this error: error:more than one device So, my questions are:.
Is that normal that two phones to have the same serial no?. Can I change the serial no?. Is there any way to run these install, push commands successfully even if the serial no are the same? BTW, the WiFi/3G network will be turned off when I'll run the test. If your device is rooted try this way to change serial number your devices, first connect one of them to your pc then type this in cmd adb devices this shows your device id (serial number). List of devices attached P753A12D device pick some new name,for example NAME1 then type this commands adb shell su devicename='NEWNAME' cd /sys/class/androidusb/android0/ echo -n $devicename iSerial cat iSerial exit exit from root exit exit from shell START now unplug the usb cable and run this commands adb kill-server connect your device again and type adb devices now you can see changes List of devices attached NewNAME device END note: if it did not work first time disconnect your phone and do this parts of my guide from START to END again. Is that normal that two phones to have the same serial number?
The purpose of the serial number is to uniquely identify the device, so they should be different. That being said, some manufacturers don't bother. It's also possible that the firmware is reporting the number incorrectly. You can check the serial number on the actual devices, and see if it matches what adb is reporting. Settings About Device Phone Identity Device Serial Number 2.
Can I change the serial number? There isn't an easy or consistent method for doing this that I'm aware of. Here are some examples where others have accomplished this feat (but I have not): 3. Is there any way to run these install, push commands successfully even if the serial numbers are the same? There shouldn't be any problem running commands if only one device is connected at a time. The answer given by @mirokropacek works for Linux (and presumably Mac, too) but doesn't work for Windows, unfortunately. This is due to the way the registerusbtransport function is called in Windows.
It turns out the devpath parameter is always NULL in Windows. I needed to handle the same situation so I adapted the solution given above to randomly generate a device ID for each device if the serial parameter is NULL or it is empty (zero length). I don't need to worry about differentiating devices over long periods of time and many devices so generating a pseudo-random number for the device ID with rand, then using sprintf to create a string representation of that ID seems to be sufficient for my needs but YMMV. It only generates a 4-digit hex number but it works well enough for me (for now at least).
Serial Number Idm
Save the date! Is coming to Mountain View, CA on November 7-8, 2018. Meet Android Studio. Manage your project. Add C and C code.
Write your app. Build and run your app. Run apps on the emulator. Run apps on a hardware device. Configure your build. Debug your app.
Test your app. monkeyrunner reference. Profile your app. Inspect threads and method traces. Publish your app. Command line tools.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |