Xi 张熹
Xi 张熹

Reputation: 11071

Android app closes automatically right after lauching

I am writing an android app and testing in on my own phone. It's working properly except that sometimes after I click the icon, the app shows up for half a second and then closes. The weird things are:

  1. It only happens about once in 20 times.
  2. When it crashes, if you try to re-open the app it will crash too. You have to do something else (like using another app) before you can open the app normally.
  3. When it crashes, if you try to open some other cheap apps they will crash too. (But not those decent ones like "Angry Bird")

Following are my configuration settings:

I suspect the problem might have something to do with the OS version or even device type. Has anyone experienced this problem before? The app is still OK to use, but this is a really bad user experience.

Thanks,


I attached my phone to Logcat as suggested, but it just got weirder. When the app is running, I can see the log is updating and everything is fine. When it crashes, all the log information in Logcat console is gone. There is only one line with tag “WindowManager” left saying:

"Delivering key 4 to Window{ ...}"

And the time column is changing quickly. I assume it means I am keep pressing cancel button, which I am not. Does anyone has experience with this?

Thanks,

Upvotes: 0

Views: 18095

Answers (3)

David Baskin
David Baskin

Reputation: 1

Went to developer options ,Under applications , do not keep activities-turned off .Tried camera settings ,page came out and stayed as it should -Hope this helps , DB

Upvotes: -1

Xi 张熹
Xi 张熹

Reputation: 11071

I have tried everything I could think of:

I added System.gc() on start and quit, I added Systme.exit(0) on quit, and I added "kill process" on quit.

Unfortunately none of those worked. After talking to a few friends now I believe it's the problem is caused by Samsung I9000S with their version of Android 2.1 Update 1. Once updated to 2.2, the problem is gone.

Upvotes: 0

levis501
levis501

Reputation: 4207

Your app may not be resuming properly. When you leave the app and do something else, the app is restarted from scratch. When you leave and immediately come back, the app is resumed.

Check out the flowchart at http://developer.android.com/reference/android/app/Activity.html

Also, I'd like to re-iterate Cristian's comment. Please post a stack trace of the crash.

Upvotes: 3

Related Questions