Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

android wont re run

Posted on 2012-03-21
24
Medium Priority
?
373 Views
Last Modified: 2012-03-26
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
Comment
Question by:jagguy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 9
  • 5
24 Comments
 
LVL 47

Expert Comment

by:for_yan
ID: 37745955
Didn't you write that it works in the previous question ?
So it worked and then stopped working?
0
 

Author Comment

by:jagguy
ID: 37745970
unfortunately yes this happened.
0
 
LVL 47

Expert Comment

by:for_yan
ID: 37745982
so you installed two platforms - 4 0 3 and one older platform  ?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:jagguy
ID: 37745987
android 4.03 works fine and i can re run this but 2.2 isnt
0
 
LVL 47

Expert Comment

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

Author Comment

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

Expert Comment

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

Expert Comment

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

Author Comment

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

Expert Comment

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

Author Comment

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

Expert Comment

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

Author Comment

by:jagguy
ID: 37746139
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
 
LVL 8

Expert Comment

by:Santhana
ID: 37746406
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
 

Author Comment

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

Expert Comment

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

Author Comment

by:jagguy
ID: 37746445
0
 
LVL 47

Expert Comment

by:for_yan
ID: 37746466
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
 
LVL 8

Expert Comment

by:Santhana
ID: 37746467
Hi  jagguy,

Try this in command prompt ....       adb -e kill-server. Then run your project again....It will start the fresh abd.....
0
 
LVL 8

Expert Comment

by:Santhana
ID: 37746471
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
 

Accepted Solution

by:
jagguy earned 0 total points
ID: 37746587
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
 
LVL 8

Expert Comment

by:Santhana
ID: 37746606
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
 
LVL 8

Expert Comment

by:Santhana
ID: 37750901
Hi  jagguy,

Have you tried my suggestions...?????
0
 

Author Closing Comment

by:jagguy
ID: 37765002
I found the solution
0

Featured Post

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
There is a lot to be said for protecting yourself and your accounts with 2 factor authentication.  I found to my own chagrin, that there is a big downside as well.
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 video teaches viewers about errors in exception handling.
Suggested Courses

704 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