Solved

android wont re run

Posted on 2012-03-21
24
366 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
  • 10
  • 9
  • 5
24 Comments
 
LVL 47

Expert Comment

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

Author Comment

by:jagguy
Comment Utility
unfortunately yes this happened.
0
 
LVL 47

Expert Comment

by:for_yan
Comment Utility
so you installed two platforms - 4 0 3 and one older platform  ?
0
 

Author Comment

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

Expert Comment

by:for_yan
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
>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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

by:jagguy
Comment Utility
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:santhanasamy
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
0
 
LVL 47

Expert Comment

by:for_yan
Comment Utility
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:santhanasamy
Comment Utility
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:santhanasamy
Comment Utility
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
Comment Utility
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:santhanasamy
Comment Utility
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:santhanasamy
Comment Utility
Hi  jagguy,

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

Author Closing Comment

by:jagguy
Comment Utility
I found the solution
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Office 365 setup on Android phone 6 45
wordmultiple challenge 12 89
Unable to start eclipse ? 17 82
JList custom Cell Renderer refresh 15 39
The case of the missing phone talks about the way a small electronic gadget (the mobile phone) has penetrated into our lives and has made us addicted to it.
You should read OS supplied guidelines before developing. I can't stress that enough. The guidelines will help you understand the reasons mobile app developers do what they do.  Apple is very particular when they review appstore submissions.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

771 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

13 Experts available now in Live!

Get 1:1 Help Now