[Q] Android OS development - Android Software/Hacking General [Developers Only]

Hi folks,
I have a few question here.
1) I love to have a look inside Android internals (lets say v2.3).
For eg, I may want to change the way lock screen looks or works.
or change the way menu works/see (icons).
As of now, i dont have an android phone. I love to test that in an emulator.
How can i do that?
2) I have an apk file. How will work/run that in an emulator?
Thanks a lot.

There are instructions for the Android emulator here:
http://www.androidguys.com/2010/12/15/android-emulator/
Once that's running, you should just need to open a cmd prompt, and type
adb install nameofmy.apk
(if you get an 'adb' is not a recognised command, you'll need to CD to the 'platform-tools' folder from the sdk first)

Related

Need help with ADB

I am pulling my hair out. I have SDK installed and whatever I was instructed to install on SDK, for the life of me I can't get the command shell to work. When I open a command shell and type adb. I get a message 'adb' is not a recognized as an internal or external command, operable batch or program file.
My phone is plugged in debugging checked, I have it set to mass storage, not kies. What am I doing wrong.
Sorry for the noob question. I have been reading every forum I can find, every document I can find. I am trying to learn and I like to mess with my phone and should know how to use adb command shells.
Can someone tell me what I am doing wrong?
Thanks.
Rhiannon224 said:
I am pulling my hair out. I have SDK installed and whatever I was instructed to install on SDK, for the life of me I can't get the command shell to work. When I open a command shell and type adb. I get a message 'adb' is not a recognized as an internal or external command, operable batch or program file.
My phone is plugged in debugging checked, I have it set to mass storage, not kies. What am I doing wrong.
Sorry for the noob question. I have been reading every forum I can find, every document I can find. I am trying to learn and I like to mess with my phone and should know how to use adb command shells.
Can someone tell me what I am doing wrong?
Thanks.
Click to expand...
Click to collapse
PC or mac?
On a PC cd /Android/Tools then use adb commands
on a Mac: cd /Android/Tools then use ./adb then the command
PC. Thanks I will try that.
update
system cannot find the path specified
I am ready to delete everything and start over, maybe the path is wrong and I borked something in the download. There should be an Android for dummy's book or something, for us noobs.
where did you install the files? You had to download the SDK and unzip it.
Then you use a command window to change directories to where ever you installed it. Then run the commands.
If you don't know how to move around directories using DOS commands, you better find a tutorial on that first.
Your problems sound like you are not in the tools directory - CMD issues not Adroid - CMD is the windows shell btw.
alphadog00 said:
where did you install the files? You had to download the SDK and unzip it.
Then you use a command window to change directories to where ever you installed it. Then run the commands.
If you don't know how to move around directories using DOS commands, you better find a tutorial on that first.
Your problems sound like you are not in the tools directory - CMD issues not Adroid - CMD is the windows shell btw.
Click to expand...
Click to collapse
downloaded and upzipped. It's in a folder named Android, in my c;/drive. I watched a tutorial and put it where I thought I was supposed to, then I made sure to edit the path. I can undo that. I know it's a CMD issue. Great DOS commands, this is a little over my head.
I's probably easier for me to delete everything and start over.
Is there an ADB for dummies or anything. I find them for other devices not Captivate?
if you change directories to the tools directory, do you see adb.exe listed? I am not sure which tutorial you used, but there is no reason to edit the path if you change directly into the android sdk/tools directory.
In a CMD window, change to the tools directory and do a DIR and see if the first file is adb.exe
Deleting and starting over is not going to change things at this point. Also ADB is a command that works the same regardless of which phone you have. The only things that are different is if you can mount the system partition - depends on your kernel - is it custom. Not phone dependent though.
alphadog00 said:
if you change directories to the tools directory, do you see adb.exe listed? I am not sure which tutorial you used, but there is no reason to edit the path if you change directly into the android sdk/tools directory.
In a CMD window, change to the tools directory and do a DIR and see if the first file is adb.exe
Deleting and starting over is not going to change things at this point. Also ADB is a command that works the same regardless of which phone you have. The only things that are different is if you can mount the system partition - depends on your kernel - is it custom. Not phone dependent though.
Click to expand...
Click to collapse
Thanks I did this and no it isn't listed. the Android folder is, that is where I extracted all the files. Should I move from the folder. After extracting the files did I need to install anything from it?
Rhiannon224 said:
Thanks I did this and no it isn't listed. the Android folder is, that is where I extracted all the files. Should I move from the folder. After extracting the files did I need to install anything from it?
Click to expand...
Click to collapse
You should have extracted everything. You should have a folder that extracted:
android-sdk-windows and in that a tools folder. In the tools folder is ADB.exe
It is one big zip file - nothing to install - just unzip where you want it.
hold shift and then right click on that tools folder(wherever you put it), select open command window here from the menu, then type adb to make sure it worked
Kagoshema said:
hold shift and then right click on that tools folder(wherever you put it), select open command window here from the menu, then type adb to make sure it worked
Click to expand...
Click to collapse
Thank you. That did the trick. It is there and it worked. So I am guessing that when I want to open a command shell and use ADB this is how I will be able to do it. Thank you so much for all of your help everyone.
I am very new to Android and smart phones, 7 weeks now and I am trying to learn as much as I can and I try to find the information without asking too many questions.
Last night with SRE and it's sleeping death made me realize that I need to know how to use ADB and a command shell should things go wrong.
Again, thanks to everyone for the help.

[Q] How to install Market ?

Sorry to be a noob about this but could someone post a how to install on a new Apad?
I've installed superuser already which I assume is working??
This is one of the new IMX 515's Android 2.2 800 mhz tablets with 10.1 flash etc.
Where do I go from here to get the Market installed?
Sorry folks but I'm kind lost.
Thanks for your help.
I got one of those 9.7" iMX515's and I have the same question...
If you need the market installed search the forums for market.apk.
Please use the forum search feature before posting next time.
Have any more questions, msg me on gtalk at androidsamurai.
Sent from my Hacksung - M910 using Tapatalk
I managed to get part way there. Basically I followed the instructions here (http://www.androidtablets.net/forum...tall-instructions-imx515-cnddu.html#post37829)
and here (original post: http://www.padbbs.net/thread-2909-2-1.html).
I had problems getting the adb to work on my Mac, but finally managed to figure that one out:
Download the sdk and unzip in a folder of your choice.
Set your slate to USB debugger "on" and plug in to your mac. I think I didn't actually mount my slate when I did this (neither memory was mounted on my desktop when I executed the process), but have a go and see if there is a difference in adb behaviour.
Run the Unix executable called "android" in the "tools" sub-folder. Then run the "adb" executable.
These should both open up their own terminal window. Then open a new terminal window. The fastest way to insert adb commands is by dragging the adb file into the window and follow up with your adb command.
Start off with "adb shell", which gives you a hash (sorry, my keyboard won't give me the sign) as line start. Then start using adb command lines (drag drop adb into the window, followed by "push", followed by drag-dropping the file you want to push into the terminal window, followed by typing where you want it to go, e.g. /systems/app.
Do this for all the files mentioned and you should be there.
Now, this is as far as I got myself! When I restarted, I had the market app in my app list, but when I start the google sign in service, I continuously get the message "can't connect to server", and I have no idea how to get passed that point. SO suggestions for that one will be welcome!
I have a mac. How do I install a firmware without recovery mode? I don't have recovery mode, doesn't exist on my unit

[Q] adb shell command prompt

I am new to all this and completely lost. I am trying to be able to access adb shell through command prompt. I have done everything here:
http://forum.xda-developers.com/showthread.php?t=500196
And it still doesn't work. I'm lost. I'm not sure where it was downloaded to. I can find it in my program files under Android. But when I try to put C:\android... it doesn't actually come up. But if I go to explore and go find it, it is... so I think maybe the path isn't set up the same or something. i dunno. I dont get it lol.
Any help would be awesome!
Thanks,
Kimberly.
Hi,
So after you downloaded the zip file did you unzip / install it? as you will need to unzip the file. So for example you may have downloaded it to your download folder so double click the zip and unzip. The you should see a Android folder like "android-sdk-windows".
Once you know where it is you can then either add this to the envrioment varables or could can navigate to the adb program via the command prompt and run it there.
I.e. cd C:\Users\yourname\Downloads\android-sdk-windows\
then type adb shell
There is a guide here: - http://developer.android.com/sdk/installing.html
So have a look in your C drive (Go to My computer, C drive) then look for a folder called "android-sdk-windows"
C:\android-sdk-windows

[Q] ADB

How do you set up ADB and what are the resources you need?
All you need is just to download ADB. For me at first i went to download SDK manager and downloaded a LOT of files and got the adb. I found an easier way though. In superoneclick root latest version i downloaded theres a folder called "ADB". I copied it to the desktop so i have easy access. To use ADB, go to command prompt and type in the location you have placed the ADB folder in, if you copied it to the desktop like me, type cd Desktop\ADB and hit enter. Then type adb shell and you're good to go. You can go search up on some commands as i dont use it very often and not familiar with all the commands. have fun using it
jus download the adb zip .its there in the devlopment thread .......and extract it in the c drive of your system...and jus change directory in the command prompt and you are gud to go

Top cmds that you need to know

There are servel cmds which we can use
But I post only top 10 cmds to help that ones who need
###############
If I make a mistake so please reply with your suggestions
And if you want a cmd in the list .submit your reply with cmd and features ( full detail as you know.).
########cmds###########
For a lot of us, the fact that we can plug our Android phone or tablet into our computer and interact with it 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. 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 at the Android developers site. 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. The tools themselves are the easy part. Download this file. 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 hidden in Android 4.2), and plug it in to your computer. Now skip past the break and let's begin!
1. 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 the file 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.
2. The adb push command
If you want to move a file onto your Android device programmatically, you want to use the adb push command. 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. Either way works, but it's always easier to just drop the file into your tools folder and save the typing.
3. 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.
5. 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.
6. 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.
7. 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 <command>". 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.
9. The adb install command
While adb push 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 sideload 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 -s switch 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.
10. 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.
You also have to specify the cmds properly.
Hope it help you .
Like my work hit thanks button.
$$$$$$$$$$$$$$$$$$$$$$$$
Any suggestions most welcome.
$$$$$$$$$$$$$$$$$$$$$$$$$

Categories

Resources