为什么我的应用程序无法在 Android 2.3 上运行?

发布于 2024-10-09 21:17:26 字数 1304 浏览 0 评论 0原文

只是一个关于 Android 2.3 的简单问题。

我收到了使用我的应用程序的用户的报告,称它在 Android 2.3 中启动时崩溃。据我所知,它在其他 SDK 版本上运行得非常好。由于我没有运行 Android 2.3 的手机,我无法测试错误出在哪里,这使得处理起来非常令人沮丧!

有谁知道 Android 2.3 中可能发生哪些变化导致应用程序崩溃吗?还有其他人遇到过类似的问题吗?

以下是我对可能导致它的原因的想法...

  1. 启动屏幕 - 在我的主要活动中,我在 onCreate 中触发它,它在完成之前显示 3 秒
  2. 我正在使用 Android 的 GPS 功能,这在很大程度上2.3 中发生了变化,意味着出了什么问题?
  3. 2.3 中的应用程序启动发生了根本性的变化,但我并不知道。

任何反馈将不胜感激!

** 更多信息! **

在 Nexus S 上运行它的人的帮助下,我通过以下方法找到了问题:

final 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();

有谁知道为什么这突然无法在 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...

  1. Splash screen - on my main activity I trigger this in onCreate and it displays for 3 secs before finishing
  2. I'm using the GPS capability of Android, has this vastly changed in 2.3 to mean that something's going wrong?
  3. 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:

final 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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

执妄 2024-10-16 21:17:26

我的所有应用程序都使用此:

http://jyro.blogspot .com/2009/09/crash-report-for-android-app.html

帮助您轻松追踪错误。

All my apps use this:

http://jyro.blogspot.com/2009/09/crash-report-for-android-app.html

Helps you track down bugs easily.

趁年轻赶紧闹 2024-10-16 21:17:26

如果这是 Gingerbread 的非官方版本,则 GPS 很可能已损坏。在我尝试过的所有版本中,GPS 均不起作用。当应用程序搜索 GPS 时找不到它,因此会崩溃。这种行为发生在 Moto Droid 2.3 的原生浏览器中。因为它加载 google.com 并要求使用 GPS 定位,所以它崩溃了。如果这种情况发生在官方版本上(目前只有 Nexus S?),则忽略所有这些。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文