Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 377
  • Last Modified:

cant run android more than once

I cant run an android app more than once in eclipse.
The default 'hell world' app only runs once.

After running the 'hello world' app once and it works I then close the emulator, and then hit run again. The program then hangs and doesnt do anything.

I dont remember this happening before?
0
jagguy
Asked:
jagguy
  • 11
  • 8
1 Solution
 
for_yanCommented:
If you don't close the emulator - does it run again in the same emulator ?

(Change the text of Hello, ... so that you see)
0
 
for_yanCommented:
Did you go to Windows - AVD menu and set the checkbox on the emulator
(shows green chcheckbox), and select automatic

Even though I had only one slection there but before I did that it on each run created new emulator and it took a long time. After I did that itjust replaced my application in the existing emulator - it was much faster.
True, I didn;t exoerience that it hanged though even when it created new emulator.

and if it hangs - if you then restart Eclipse - would it run again OK for the first time after Ecliopse restart?
0
 
jagguyAuthor Commented:
I run the program ok.

if I change the  text to hello world 2 and run it again nothing happens other than the program tries to run again and it doesnt.

How do I edit the file and re-run the program without waiting a few minutes each time for the emulator to load?
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
for_yanCommented:
>How do I edit the file and re-run the program without waiting a few minutes each time for the emulator to load?

That is exactly what I achieved after I went to Windows - AVD and set the checkbox on the emulator and set checkbox to aoutomatic

after that it didn't create a new emulatorbut just put new version of program to the saem emeulator  (but you should not clsoe it of ciurse after the first run)
0
 
jagguyAuthor Commented:
i go windows - avd manager and see 2 devices with green ticks I created before.

there is no automatic option?
0
 
jagguyAuthor Commented:
I also tried the run config automatic options , change the code and rerun the program without closing emulator.

still no good
0
 
for_yanCommented:
Yes, automatic is in different place - go to Run Configurations - then sleect Target tab - there I guess you'll need to have only one of two emulators checked and on top left there is automatic checkbox
0
 
for_yanCommented:
I have only one emaulator - os in target screen I have that one checked and automatic checked also
0
 
jagguyAuthor Commented:
this doesnt do anything for me. I checked automatic and have the correct program on left pane and auto checked with emaulator 2.2 (choice of 2) but I select 1 of course.

then i change my code 'hello world 3' and click run....nothing happens on emulator as there is a program trying to run in the background and hangs at 27%


How do I change my code and get the emulator to display new code without closing emulaor from last time I run the pogam?
0
 
for_yanCommented:
where do you cahnge your code to hello world 3 - post your code

>hangs at 27%

what that means ? and where do you get %

and what happnes when you close Eclipse and start Eclipse again
0
 
jagguyAuthor Commented:
package com.home;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;


public class Thome1Activity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        TextView tv = new TextView(this);
        tv.setText("Hello, Android 3");
        setContentView(tv);
    }

}

I run this and it works.
If I change   this line
  tv.setText("Hello, Android 3");

to

    tv.setText("Hello, Android 4");

and hit run , the emulator doesnt display the new code. in Progress tab in eclipse it says 27% and tries to keep running new code (it just repeats)
0
 
for_yanCommented:
Yes, that is correct code and works for me
0
 
jagguyAuthor Commented:
when you change the code what do you do?
do you simply click run again ?

what is the process for changing code and running the code again without waiting for the emulator to load again.
0
 
for_yanCommented:
As I told you, initially, when I didn't have those things checked and automatic - I changed the code and then clicked Run and it took again the whole time and created new emulator
(but still didn't hang)

when i checked and in Run -conf - Target screen and made automatic - after that - i click
Run as Android after changing the code and it changes the text rather quickly in the same emulator

In the console it should show you some output - any errors there when it hangs ?
0
 
for_yanCommented:
If I were you, I'd try to create a new project - maybe something gits screwed in that project
0
 
for_yanCommented:
I am also running everything in 4.0.3
0
 
jagguyAuthor Commented:
yes it worked in 4.03 as your instructions said  but not in  android AVD 2.2

so I dont want to code for 4.03 as it is too new, what do I do?
0
 
jagguyAuthor Commented:
ok it worked.

I had to create a new project again.
0
 
for_yanCommented:
Good!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 11
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now