MapView 抛出 IllegalArgumentException - 图像大小错误:192 192

发布于 2024-12-05 14:49:54 字数 2085 浏览 1 评论 0原文

我从 Samsung Vibrant Galaxy S 上的用户那里收到了过多的崩溃报告。在四处寻找此问题的解决方案后,我唯一遇到的是 Google Code 上的一个未解决问题:http://code.google.com/p/android/issues/detail?id=4599

该线程建议扩展 MapView 并捕获例外情况。这是最好的方法,还是有更好的方法?我想彻底解决这个问题,而不是用绷带包扎它。

这是堆栈跟踪:

java.lang.IllegalArgumentException: wrong image size: 192 192
at com.google.googlenav.map.MapTile.getImage(Unknown Source)
at com.google.googlenav.map.Map.drawTile(Unknown Source)
at com.google.googlenav.map.Map.drawMapBackground(Unknown Source)
at com.google.googlenav.map.Map.drawMap(Unknown Source)
at com.google.android.maps.MapView.drawMap(MapView.java:1048)
at com.google.android.maps.MapView.onDraw(MapView.java:486)
at android.view.View.draw(View.java:6597)
at android.view.ViewGroup.drawChild(ViewGroup.java:1533)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1260)
at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1260)
at android.view.View.draw(View.java:6600)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at android.view.ViewGroup.drawChild(ViewGroup.java:1533)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1260)
at android.view.View.draw(View.java:6600)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1884)
at android.view.ViewRoot.draw(ViewRoot.java:1374)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1139)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1658)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4363)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
at dalvik.system.NativeStart.main(Native Method)

I'm getting excessive crash reports from users on a Samsung Vibrant Galaxy S. After searching around for solutions to this issue, the only thing I came across was an open issue over at Google Code: http://code.google.com/p/android/issues/detail?id=4599

The thread suggests extending MapView and catching the exceptions. Is this the best approach, or is there something better? I'd like to completely fix this issue rather than throw a bandage on it.

Here's the Stack Trace:

java.lang.IllegalArgumentException: wrong image size: 192 192
at com.google.googlenav.map.MapTile.getImage(Unknown Source)
at com.google.googlenav.map.Map.drawTile(Unknown Source)
at com.google.googlenav.map.Map.drawMapBackground(Unknown Source)
at com.google.googlenav.map.Map.drawMap(Unknown Source)
at com.google.android.maps.MapView.drawMap(MapView.java:1048)
at com.google.android.maps.MapView.onDraw(MapView.java:486)
at android.view.View.draw(View.java:6597)
at android.view.ViewGroup.drawChild(ViewGroup.java:1533)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1260)
at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1260)
at android.view.View.draw(View.java:6600)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at android.view.ViewGroup.drawChild(ViewGroup.java:1533)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1260)
at android.view.View.draw(View.java:6600)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1884)
at android.view.ViewRoot.draw(ViewRoot.java:1374)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1139)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1658)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4363)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
at dalvik.system.NativeStart.main(Native Method)

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

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

发布评论

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

评论(2

梦醒时光 2024-12-12 14:49:54

希望其他人会出现另一个答案来证明我是错的,但根据我个人对设备特定问题的经验,捕获异常通常似乎是您能做的最好的事情。

编辑下面的评论:这是一点,在扩展 WebView 一次时,我确实遇到了使用自定义 WebView 代码的特定设备的一些新问题。

这里有很多人比我有更多的经验,我希望其中一位能够提供更明确的答案或更少的解决方案,但如果有必要,您可以随时使用 android.os。 Build.DEVICE、android.os.Build.MODEL 和/或 android.os.Build.PRODUCT 来确定应用程序是否在 Samsung Vibrant 上运行Galaxy S,并且(通过反射)使用自定义 MapView仅当有类时。

Hopefully someone else will show up with another answer to prove me wrong, but in my personal experience with device-specific issues, catching the exceptions often seems to be the best you can do.

Edit regarding your comment below: That is a point, and I did run into some new problems with specific devices using customised WebView code when extending WebView once.

There are a ton of people on here with far more experience than me, and I hope one of them will drop in to give a more definitive answer or less hacky solution, but if necessary, you could always use android.os.Build.DEVICE, android.os.Build.MODEL and/or android.os.Build.PRODUCT to determine whether the app is running on a Samsung Vibrant Galaxy S, and (via reflection) use the custom MapView class only if it is.

忆离笙 2024-12-12 14:49:54

可能是您在这里犯了错误,因此将代码更改为正确的形式,或者输入

  <uses-library android:name="com.google.android.maps"   // in manifest under inside applicaiton tag
              android:required="true"/>


//wrong usage of activity
 public class A extends Actvitiy 
 {
  }
    //correct usage
  public class A extedns MapsActivity 
 {
      //your all program...
   }

May be You have done mistake here, so change the code to correct form, or enter

  <uses-library android:name="com.google.android.maps"   // in manifest under inside applicaiton tag
              android:required="true"/>


//wrong usage of activity
 public class A extends Actvitiy 
 {
  }
    //correct usage
  public class A extedns MapsActivity 
 {
      //your all program...
   }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文