应用程序更新后不断关闭

发布于 2024-12-21 20:01:26 字数 2367 浏览 2 评论 0原文

我最近推送了一个应用程序的更新,现在我从用户那里收到了大量关于它在打开应用程序之前崩溃的崩溃报告。我有堆栈跟踪,但我不认识其中的任何类 - 所以我什至不知道从哪里开始查找。

这是堆栈跟踪:

v2.0    Dec 16, 2011 11:00:03 AM          17 reports/week              17 reports
java.lang.NullPointerException
at android.graphics.Rect.<init>(Rect.java:72)
at android.graphics.drawable.ShapeDrawable.mutate(ShapeDrawable.java:359)
at android.widget.ImageView.applyColorMod(ImageView.java:1275)
at android.widget.ImageView.onSetAlpha(ImageView.java:290)
at android.view.ViewGroup.drawChild(ViewGroup.java:1614)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6883)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6883)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2094)
at android.view.ViewRoot.draw(ViewRoot.java:1525)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1261)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1862)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3806)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)

有什么想法可能是这里的真正罪魁祸首或者至少我应该调查什么?

我们已将 minSdkVersion 更改为更高的 API,具有较低 API 的用户是否可能会尝试更新,或者在这种情况下他们甚至无法下载它?

非常感谢任何帮助!谢谢你!

更新:@LuxuryMode,谢谢您的回复!不幸的是,这就是我在应用程序帐户崩溃错误下的崩溃报告中看到的全部内容,我应该寻找其他地方吗?它会一遍又一遍地发布日期和时间、应用程序的版本和报告数量,然后是堆栈跟踪。

顶部有以下内容:

Exception class     java.lang.NullPointerException
Source method       Rect.<init>()

我们尝试在应用程序启动时为 C2DM 注册用户 - 如果 API 级别低于 8,应用程序会崩溃还是会默默地失败? (尽管我在这个堆栈跟踪中没有看到任何特定于 C2DM 的内容)

I recently pushed an update for an app, and now I'm getting a lot of crash reports from users about it crashing before even opening the application. I have the stack trace, but I don't recognize any of my classes in it - so I have no idea where to start looking even.

This is the stack trace:

v2.0    Dec 16, 2011 11:00:03 AM          17 reports/week              17 reports
java.lang.NullPointerException
at android.graphics.Rect.<init>(Rect.java:72)
at android.graphics.drawable.ShapeDrawable.mutate(ShapeDrawable.java:359)
at android.widget.ImageView.applyColorMod(ImageView.java:1275)
at android.widget.ImageView.onSetAlpha(ImageView.java:290)
at android.view.ViewGroup.drawChild(ViewGroup.java:1614)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6883)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
at android.view.View.draw(View.java:6883)
at android.widget.FrameLayout.draw(FrameLayout.java:357)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2094)
at android.view.ViewRoot.draw(ViewRoot.java:1525)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1261)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1862)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3806)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)

Any ideas what the actual culprit could be in here or at least what I should be looking into??

We've changed the minSdkVersion to a higher API, would it be possible that users with a lower API might be trying to update or could they not even download it in that case?

Any help is greatly appreciated! Thank you!

UPDATE: @LuxuryMode, thank you for your reply! Unfortunately, this is all I'm seeing in the crash report under crash errors in our application account, should I be looking somewhere else? It posts the date and time, the version of the application and the number of reports, followed by this stack trace, over and over.

At the top, there's the following:

Exception class     java.lang.NullPointerException
Source method       Rect.<init>()

We're trying to register users for C2DM when the application starts - would the application crash if the API level is lower than 8 or would it just fail silently? (though I'm not seeing anything C2DM specific in this stack trace)

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

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

发布评论

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

评论(1

花开浅夏 2024-12-28 20:01:26

我知道为时已晚,但我重现了这个问题并找到了解决方案。

当 ShapeDrawable 对象的填充为 (0, 0, 0, 0) 并且该对象需要突变时,API 15 及以下版本中存在此问题。例如,这可能发生在对 ImageView 的 setAlpha(...) 调用上。

问题是 ShapeDrawable.setPadding(int, int, int, int) 的旧实现会检查参数是否为零,并在本例

public void setPadding(int left, int top, int right, int bottom)
{
    if ((left | top | right | bottom) == 0) {
        mShapeState.mPadding = null;
    }
}

中将 填充 Rect 设置为 null: r) 构造函数在接收空参数时会崩溃。

因此,解决方案是添加 drawable.setPadding(new Rect()); 以避免 NPE 情况。

I know it's too late, but I reproduced this problem and found the solution.

This problem exists for API 15 and below when padding for the ShapeDrawable object is (0, 0, 0, 0) and this object needs mutation. This may happen on setAlpha(...) call for ImageView, for example.

The thing is that the old implementations of ShapeDrawable.setPadding(int, int, int, int) check parameters for zeros and in this case set the padding Rect to null:

public void setPadding(int left, int top, int right, int bottom)
{
    if ((left | top | right | bottom) == 0) {
        mShapeState.mPadding = null;
    }
}

At the same time the Rect(Rect r) constructor simply crashes on receiving null parameter.

So, the solution is in adding drawable.setPadding(new Rect()); to avoid the NPE condition.

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