Solved

cant run android more than once

Posted on 2012-03-20
19
359 Views
Last Modified: 2012-03-20
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
Comment
Question by:jagguy
  • 11
  • 8
19 Comments
 
LVL 47

Expert Comment

by:for_yan
ID: 37745081
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
 
LVL 47

Expert Comment

by:for_yan
ID: 37745118
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
 

Author Comment

by:jagguy
ID: 37745120
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
 
LVL 47

Expert Comment

by:for_yan
ID: 37745136
>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
 

Author Comment

by:jagguy
ID: 37745155
i go windows - avd manager and see 2 devices with green ticks I created before.

there is no automatic option?
0
 

Author Comment

by:jagguy
ID: 37745179
I also tried the run config automatic options , change the code and rerun the program without closing emulator.

still no good
0
 
LVL 47

Expert Comment

by:for_yan
ID: 37745180
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
 
LVL 47

Expert Comment

by:for_yan
ID: 37745183
I have only one emaulator - os in target screen I have that one checked and automatic checked also
0
 

Author Comment

by:jagguy
ID: 37745216
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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 47

Expert Comment

by:for_yan
ID: 37745226
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
 

Author Comment

by:jagguy
ID: 37745275
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
 
LVL 47

Expert Comment

by:for_yan
ID: 37745282
Yes, that is correct code and works for me
0
 

Author Comment

by:jagguy
ID: 37745303
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
 
LVL 47

Accepted Solution

by:
for_yan earned 500 total points
ID: 37745309
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
 
LVL 47

Expert Comment

by:for_yan
ID: 37745325
If I were you, I'd try to create a new project - maybe something gits screwed in that project
0
 
LVL 47

Expert Comment

by:for_yan
ID: 37745338
I am also running everything in 4.0.3
0
 

Author Comment

by:jagguy
ID: 37745377
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
 

Author Comment

by:jagguy
ID: 37745390
ok it worked.

I had to create a new project again.
0
 
LVL 47

Expert Comment

by:for_yan
ID: 37745400
Good!
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Working settings for French ISP Orange "Prêt à Surfer" SIM cards for data connections only. Can't be found anywhere else !
This is an explanation of a simple data model to help parse a JSON feed
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now