Link to home
Start Free TrialLog in
Avatar of jagguy
jagguyFlag for Australia

asked on

android wont re run

package com.test;

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

Hi,

I am getting problems again rerunning my android app.
I am using android 2.2 .

I cant run again my app without building workspace hanging around 27% complete.
I set run-config to automatic and checked with  android platform.





public class And2_2btestActivity 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 6");
        setContentView(tv);
    }
}
Avatar of for_yan
for_yan
Flag of United States of America image

Didn't you write that it works in the previous question ?
So it worked and then stopped working?
Avatar of jagguy

ASKER

unfortunately yes this happened.
so you installed two platforms - 4 0 3 and one older platform  ?
Avatar of jagguy

ASKER

android 4.03 works fine and i can re run this but 2.2 isnt
I instaled only one, so I'm not sure I understadn - if you installed two, how does it know which libraries to use? Can you specify it when you create project?
Avatar of jagguy

ASKER

in the automatic option to re run a program you select one.

i thought i need to create a AVD for each platform.

if i want to code for android 2.2 then i need AVD for 2.2
Yes, indeed, I see you can specify the target when you create project, so you have tow Android projects - one for 4.0.3 and one for 2.2.3 ?
>if i want to code for android 2.2 then i need AVD for 2.2
taht is true, but I think it may be not enough

when you create project it also asks for the target - so you need to commit to the target from the beginning
Avatar of jagguy

ASKER

if I wan to code for android 2.2 then do I need a AVD  for just 2.2

Can I code for android 2.2 and use a AVD 4.03 .


I created a 2.2 project and it wont re run without closing eclipse and running the program once  only
Can I code for android 2.2 and use a AVD 4.03 .
Taht may be possible, but it is probably safer not to do it

In the opposite way it would probably be incorrect.
Avatar of jagguy

ASKER

to code for android 2.2 what do I do because my project is unstable.

I have a AVD 2.2 so why isnt this stable like 4.03?
with 4.0.3 does it work for you in both cases - when you close emulator - it cretaes emulator then and hwen you don't close it - it then just replaces the application ?
(it works so for me).

And in case of 2.2 - in both these cases it just hangs second time ?
Avatar of jagguy

ASKER

yes 4.03 works fine as you mentioned.

2.2 only runs once , the emulator works and then I need to reboot eclipse to run the 2.2 app again
Hi  jagguy,

1) Some times if you run the application from newer version to older version it will not work. It will simply hangs . I guess adb is creating problem while doing so...

What i used to do is  just kill the old adb through "adb -e kill-server" then start the server again through "adb -e start-server"..

2)  While creating a android project itself it will ask the "Build Target". Here  while creating project in platforms - 4 0 3  you have selected  Build Target as "Android 4.0".
This property will be seted in your application manifest.xml as <uses-sdk android:minSdkVersion="11">
So if you try to run the same project by using the lower version like android 2.2 , i guess it will not allow to install the application. So here this property need to be changed....
Avatar of jagguy

ASKER

I have 2 projects not 1. Each project has a different android version as I am testing it.

4.03 android app works

2.2 android app  works once only then i need to reboot eclipse and run it again.If I run this project again without rebooting eclipse  the app hangs .

so what do I do in this case? is the 2.2 corrupted o do i need to set another setting.

how do i kill the adb in windows7
I think you installed Eclipse/Android on two computers;
is it the same with 2.2 on both ?

One thing to consider  - don't worry about 2.2; learn how to write programs for 4.0.3.
By the time you write something real,  4.0.3 will already be not so new :)
It looks like those folks in the link imply that in case you do not close emulator - then it should run second time OK; in your case however that was not the case
Hi  jagguy,

Try this in command prompt ....       adb -e kill-server. Then run your project again....It will start the fresh abd.....
Hi  jagguy,

Run this command in command prompt.......
adb -e kill-server

And start the fresh adb by adb -e start-server....
I guess  this is creating  problem....
ASKER CERTIFIED SOLUTION
Avatar of jagguy
jagguy
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi  jagguy,

Also, can i kill the process in task manager in win7 or do I need command prompt to do this and from what directory?

Yes ..You can kill...through task manager...


2) From Your SDK folder.... /android-sdk/platform-tools ..( Here you can find the adb)
Hi  jagguy,

Have you tried my suggestions...?????
Avatar of jagguy

ASKER

I found the solution