Hello Android - test program

Common bugs/problems with the Android SDK the Emulator and the ADT-Plugin.

Hello Android - test program

Postby discodowney » Wed Mar 02, 2011 3:15 pm

Hi, Ive just started with Eclipse and im doing the Hello Android program here: http://developer.android.com/resources/ ... world.html

I have everything installed fine. The emulator comes up but i cant find the Hello Android program. I do everything the same as the tutorial. Then in the section called Run Application it shows a pic of what i should see when i run the program. I just see the emulator. So it looks like a normal Android phone. Ive looked around but cant find anything called Hello, Android or anything.

Does anyone know what might be going wrong?

Cheers
discodowney
Junior Developer
Junior Developer
 
Posts: 10
Joined: Wed Mar 02, 2011 3:10 pm

Top

Re: Hello Android - test program

Postby jdrefahl » Wed Mar 02, 2011 7:13 pm

Uhmm. what exactly are you looking for.. basically if you make a New Android project.. and run the mainActivity that it creates.. its essentially the same thing.. Otherwise.. if you go to new Android Project, you should see "Create Project from Exist Sample" and then a pulldown.. I believe that if your SDK is pointed to correctly in the Prefs.. you should see it there.

John
John Drefahl
Massive Media / Soundclash Media
"Changing the world, one app at a time"
http://www.twitter.com/johnsin
User avatar
jdrefahl
Junior Developer
Junior Developer
 
Posts: 15
Joined: Wed Mar 02, 2011 6:06 pm
Location: San Francisco

Re: Hello Android - test program

Postby discodowney » Wed Mar 02, 2011 7:20 pm

What i want to see is the emulator saying Hello, Android. Thats the point of the program through the link. But i cant find anything that does that in the emulator
discodowney
Junior Developer
Junior Developer
 
Posts: 10
Joined: Wed Mar 02, 2011 3:10 pm

Re: Hello Android - test program

Postby Shattered9 » Wed Mar 02, 2011 10:50 pm

I had a similar problem to this, and it still causes me problems sometimes, though I usually use my real device for testing now.

Look at your console when you try to run your app, does it ever mention uploading or installing your .apk file? Or if you have your run configuration set to let you manually pick a device to run your app on, does your emulator get listed in the "Choose Running Device" section? If both of those are no, then it is the same ADB related issue that I have been having since I began, and has even followed me through a format (Though it only happens occasionally now).

I never looked in to the real reason for this after I found a work around, but if anybody knows the real solution to this I'd love to hear it. :P Anyways, if that describes your problem then here is what I do to fix it :

1.) Open up my command prompt
2.) Type in "adb" (No quotes) and hit enter (Note that if it says it is an invalid command you may need to add the platform-tools path to your Windows Environment Variables. I could help with that if necessary.)
3.) Type in "adb kill-server" and hit enter.
4.) Type in "adb start-server" and hit enter.

This should restart your ADB and, hopefully, solve your issue. Hope this was your problem, good luck!
Shattered9
Developer
Developer
 
Posts: 39
Joined: Sat Feb 12, 2011 4:41 pm

Re: Hello Android - test program

Postby discodowney » Mon Mar 07, 2011 2:19 pm

I dont have a console come up when i run the program (well 2 come up but disappear before i can read what they say). But i do not have the emulator listed in the "Choose Running Device" section.

When i run adb do i need to be in any specific folder. Dont imagine i should. But yeah, im getting the invalid command message. So can you help with the Environmental Variables? Cheers.
discodowney
Junior Developer
Junior Developer
 
Posts: 10
Joined: Wed Mar 02, 2011 3:10 pm

Re: Hello Android - test program

Postby Shattered9 » Mon Mar 07, 2011 3:42 pm

Yes, the "command prompts" that open while starting an emulator are meant to close like that.

The following steps are based on Windows 7. I'm just kind of assuming you use Windows at this point, and I can't remember if the process is any different in other versions, but if something doesn't sync up I will try to find the answer for you.

First you will want to copy your "android-sdk-windows\tools" path directory. Hopefully you know where this folder was placed since you just recently installed it, otherwise you should be able to find the full path in your Android preferences in Eclipse (Assuming it was setup properly).

Now open up your System Properties window. The fastest way is to just hold down the Windows key and hit the "Pause/Break" button, which is near the top right of most standard keyboards. Alternatively you can right click on your My Computer icon, whether it be from the desktop, in the start menu, wherever, and click Properties.

Now, on the left side of the screen (For Windows 7 at least) you should see "Advanced System Settings" somewhere. Click on that, and in the window that pops up, click on the "Advanced" tab. Near the bottom of that window you should see "Environmental Variables". Click that.

The window that pops up should be divided into two halves. The bottom half should be labeled "System Variables". Scroll down in that box a little bit and you should see a variable called "Path". Select it and hit the "Edit" button below.

Almost done, I promise! In the "Variable Value" box, go to the very end of the line. It is quite long, so make double sure you are at the very end, things could get a little messy if you're accidentally typing in the middle of one of the other paths. At the very end, make sure the last character is a semicolon. If it is not, just put it in. Now paste in that file path we copied at the very beginning, if everything looks right hit Ok.

Now open up a command prompt and try typing in "adb" (Minus the quotes of course!) again and see if it works. Hopefully it will print out a bunch of commands and what not, at which point you can try the instructions in my other post and see if it fixes your problems, but if not post back and I will try to look into things a little more.

Good luck! 8)
Shattered9
Developer
Developer
 
Posts: 39
Joined: Sat Feb 12, 2011 4:41 pm

Top

Re: Hello Android - test program

Postby discodowney » Mon Mar 07, 2011 4:40 pm

Okay, i added the environment variable but it still isnt working. When i run adb i still get:

"adb" is not recognized as an internal or external command

I'll list out exactly what i did when installing everything and can you maybe see if i missed something:

Downloaded and installed JDK, Java SE6 Update 24: http://www.oracle.com/technetwork/java/ ... index.html

Downloaded and installed Eclipse Helios: http://www.eclipse.org/downloads/packag ... /heliossr2

downloaded and installed the Android SDK: http://developer.android.com/sdk/index.html

Downloaded the ADT Plugin and installed: http://developer.android.com/sdk/eclips ... installing
Configured the ADT Plugin and set the location to: C:\Program Files (x86)\Android\android-sdk

I open up the Android SDK and AVD Manager and install all the platforms there.

Now i start following: http://developer.android.com/resources/ ... world.html

I create an AVD for 2.1update.
I create a new project exactly as is described. Make the code changes as specified and then run using the SVD i created.

Is there anythign there i did not create or configure that you can see?
discodowney
Junior Developer
Junior Developer
 
Posts: 10
Joined: Wed Mar 02, 2011 3:10 pm

Re: Hello Android - test program

Postby Shattered9 » Mon Mar 07, 2011 6:12 pm

Ah, the problem may lie in the fact that they moved the adb on me, and I had completely forgotten. That was my bad for not going through the process and double checking things myself, sorry!

The same instructions from before apply, but adb is no longer found in ""android-sdk-windows\tools", but rather "android-sdk-windows\platform-tools".

This should be the cause of it still not showing up. Even if you did something wrong in another step of installing Android, it still should come up when you type "adb" into the command prompt. If it still doesn't work then I won't quite know what the problem is, but post back and I will try to research it a bit more.
Shattered9
Developer
Developer
 
Posts: 39
Joined: Sat Feb 12, 2011 4:41 pm

Re: Hello Android - test program

Postby discodowney » Mon Mar 07, 2011 6:26 pm

Good stuff. The adb works now.
EDIT: Nuts!!! "Choose Running Device" section still has nothing in it.

I tried that kill-server/start-server now. I still cant find the Hello, World program. Where should that be. The emulator starts up and im on the homepage. Ive checked a load of screens but just cant find it.
discodowney
Junior Developer
Junior Developer
 
Posts: 10
Joined: Wed Mar 02, 2011 3:10 pm

Re: Hello Android - test program

Postby Shattered9 » Mon Mar 07, 2011 6:39 pm

Did you do the adb kill-server/adb start-server after the emulator was started? If the emulator isn't already running when you do that it doesn't seem to work.

Once the emulator is detected properly (When it shows up in the "Running Device" list) the app should install just like it would on a phone when you run it. Actually it should launch automatically when you run it, but it will also show up with the rest of the apps if you need to close and open it again like that.
Shattered9
Developer
Developer
 
Posts: 39
Joined: Sat Feb 12, 2011 4:41 pm

Re: Hello Android - test program

Postby discodowney » Mon Mar 07, 2011 7:35 pm

Cheers. Got it working. Thats gonna be a pain in the ass if i have to do that each time. I have a HTC Desire. Am i better off using that in development?
discodowney
Junior Developer
Junior Developer
 
Posts: 10
Joined: Wed Mar 02, 2011 3:10 pm

Re: Hello Android - test program

Postby Shattered9 » Mon Mar 07, 2011 7:57 pm

It is a bit of a pain, but you only need to do it when you launch the emulator. You can then just leave the emulator running as long as you are testing and you won't need to do it again. I really should look for a permanent solution sometime since it is kind of a hassle, even if it only takes a few seconds.

I personally prefer using a real device for testing, both because I just plug it in to my front USB port and it's ready to go, and because it is more convenient having a physical device being tested every time I build my app. Whatever works best for you I suppose, just be sure to go back and test on all supported screen sizes and what not with the emulator afterward.
Shattered9
Developer
Developer
 
Posts: 39
Joined: Sat Feb 12, 2011 4:41 pm

Re: Hello Android - test program

Postby discodowney » Mon Mar 07, 2011 8:12 pm

Okay. Grand. Thanks a lot for all the help. This was driving me nuts.
discodowney
Junior Developer
Junior Developer
 
Posts: 10
Joined: Wed Mar 02, 2011 3:10 pm

Re: Hello Android - test program

Postby samstephan9 » Thu Jan 19, 2012 8:00 am

Thanks guys I have learned form your discussion.
samstephan9
Junior Developer
Junior Developer
 
Posts: 20
Joined: Wed Jul 13, 2011 12:11 pm
Location: California

Top

Return to SDK/ADT/Emulator Problems

Who is online

Users browsing this forum: No registered users and 1 guest