Go Premium for a chance to win a PS4. Enter to Win

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

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);
    }
}
0
jagguy
Asked:
jagguy
  • 10
  • 9
  • 5
1 Solution
 
for_yanCommented:
Didn't you write that it works in the previous question ?
So it worked and then stopped working?
0
 
jagguyAuthor Commented:
unfortunately yes this happened.
0
 
for_yanCommented:
so you installed two platforms - 4 0 3 and one older platform  ?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
jagguyAuthor Commented:
android 4.03 works fine and i can re run this but 2.2 isnt
0
 
for_yanCommented:
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?
0
 
jagguyAuthor Commented:
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
0
 
for_yanCommented:
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 ?
0
 
for_yanCommented:
>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
0
 
jagguyAuthor Commented:
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
0
 
for_yanCommented:
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.
0
 
jagguyAuthor Commented:
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?
0
 
for_yanCommented:
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 ?
0
 
jagguyAuthor Commented:
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
0
 
SanthanaTechnical LeadCommented:
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....
0
 
jagguyAuthor Commented:
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
0
 
for_yanCommented:
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 :)
0
 
jagguyAuthor Commented:
0
 
for_yanCommented:
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
0
 
SanthanaTechnical LeadCommented:
Hi  jagguy,

Try this in command prompt ....       adb -e kill-server. Then run your project again....It will start the fresh abd.....
0
 
SanthanaTechnical LeadCommented:
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....
0
 
jagguyAuthor Commented:
It works when I follow advice in that link...see I wasnt crazy after all with my 27% program loaded.

Launch the AVD manager and click the AVD that you've already created before, then click start button. Then once the AVD

when this is loaded with background and unlock etc then run the program from eclipse over and over again. android 2.2 needs this.


Also, can i kill the process in task manager in win7 or do I need command prompt to do this and from what directory?
0
 
SanthanaTechnical LeadCommented:
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)
0
 
SanthanaTechnical LeadCommented:
Hi  jagguy,

Have you tried my suggestions...?????
0
 
jagguyAuthor Commented:
I found the solution
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

  • 10
  • 9
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now