Why does my app not work on Android 2.3?
just a quick question about Android 2.3.
I've been receiving reports from people using my app that it crashes on startup in Android 2.3. It works absolutely fine on the other SDK versions as far as I can tell. Since I don't have a phone running Android 2.3 I can't test out where the error is, which makes it very frustrating to deal with!
Has anyone got any ideas what might have changed in Android 2.3 to mean the app crashes? Has anyone else had a similar problem?
The following are ideas I've had for what might be causing it...
- Splash screen - on my main activity I trigger this in onCreate and it displays for 3 secs before finishing
- I'm using the GPS capability of Android, has this vastly changed in 2.3 to mean that something's going wrong?
- There's been a fundamental change in application startup in 2.3 that I'm not aware of.
Any feedback would be much appreciated!
** SOME MORE INFORMATION! **
With the help of someone running it on the Nexus S I've tracked down the problem to the following method:
fina开发者_JAVA技巧l AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("GPS functionality is required for this app. Would you like to enable it?")
.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(final DialogInterface dialog, final int id) {
launchGpsOptions();
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(final DialogInterface dialog, final int id) {
dialog.cancel();
}
});
final AlertDialog alert = builder.create();
alert.show();
Does anyone know why this suddenly won't work on Android 2.3 and/or how to fix it?
Many thanks!
All my apps use this:
http://jyro.blogspot.com/2009/09/crash-report-for-android-app.html
Helps you track down bugs easily.
If this is an unofficial build of Gingerbread, GPS is most likely broken. On all builds I have tried, the GPS does not work. When the app searches for GPS it can't find it, so it will crash. This exact behavior happens in the stock browser in 2.3 for the Moto Droid. Because it loads google.com and asks for location with GPS, it crashes. If this occurs on an official build(currently only Nexus S?), then ignore all of this.
精彩评论