Droid上的zz_moto_actionbar_bkg.xml资源错误

时间:2011-12-21 04:46:43

标签: android crash-reports

我从Droid X和Droid Pro收到了奇怪的崩溃报告。

android.content.res.Resources$NotFoundException:
File res/drawable/zz_moto_actionbar_bkg.xml from drawable resource ID #0x10803a8
    at android.content.res.Resources.loadDrawable(Resources.java:1735)
    at android.content.res.Resources.getDrawable(Resources.java:596)
    at android.view.View.setBackgroundResource(View.java:7542)
    at com.android.internal.app.AlertController.setBackground(AlertController.java:719)
    at com.android.internal.app.AlertController.setupView(AlertController.java:424)
    at com.android.internal.app.AlertController.installContent(AlertController.java:232)
    at android.app.AlertDialog.onCreate(AlertDialog.java:251)
    at android.app.Dialog.dispatchOnCreate(Dialog.java:307)
    at android.app.Dialog.show(Dialog.java:225)
    at android.app.AlertDialog$Builder.show(AlertDialog.java:802)
    at com.*******.a(SourceFile:320)
    at com.*******.onOptionsItemSelected(SourceFile:292)
    at android.app.Activity.onMenuItemSelected(Activity.java:2251)
    at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:809)
    at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:143)
    at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:855)
    at com.android.internal.view.menu.IconMenuView.invokeItem(IconMenuView.java:553)
    at com.android.internal.view.menu.IconMenuItemView.performClick(IconMenuItemView.java:122)
    at android.view.View$PerformClick.run(View.java:9089)
    at android.os.Handler.handleCallback(Handler.java:587)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:123)
    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)
Caused by: java.lang.NullPointerException
    at android.graphics.drawable.LayerDrawable.addLayer(LayerDrawable.java:186)
    at android.graphics.drawable.LayerDrawable.inflate(LayerDrawable.java:157)
    at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:795)
    at android.graphics.drawable.Drawable.createFromXml(Drawable.java:736)
    at android.content.res.Resources.loadDrawable(Resources.java:1732)
    ... 27 more
java.lang.NullPointerException
    at android.graphics.drawable.LayerDrawable.addLayer(LayerDrawable.java:186)
    at android.graphics.drawable.LayerDrawable.inflate(LayerDrawable.java:157)
    at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:795)
    at android.graphics.drawable.Drawable.createFromXml(Drawable.java:736)
    at android.content.res.Resources.loadDrawable(Resources.java:1732)
    at android.content.res.Resources.getDrawable(Resources.java:596)
    at android.view.View.setBackgroundResource(View.java:7542)
    at com.android.internal.app.AlertController.setBackground(AlertController.java:719)
    at com.android.internal.app.AlertController.setupView(AlertController.java:424)
    at com.android.internal.app.AlertController.installContent(AlertController.java:232)
    at android.app.AlertDialog.onCreate(AlertDialog.java:251)
    at android.app.Dialog.dispatchOnCreate(Dialog.java:307)
    at android.app.Dialog.show(Dialog.java:225)
    at android.app.AlertDialog$Builder.show(AlertDialog.java:802)
    at com.*******.a(SourceFile:320)
    at com.*******.onOptionsItemSelected(SourceFile:292)
    at android.app.Activity.onMenuItemSelected(Activity.java:2251)
    at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:809)
    at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:143)
    at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:855)
    at com.android.internal.view.menu.IconMenuView.invokeItem(IconMenuView.java:553)
    at com.android.internal.view.menu.IconMenuItemView.performClick(IconMenuItemView.java:122)
    at android.view.View$PerformClick.run(View.java:9089)
    at android.os.Handler.handleCallback(Handler.java:587)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:123)
    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)

启动警报对话框时会发生这种情况。当然我没有使用任何这样的资源,而且我在AlertDialog上使用的资源只有android.R.drawable.ic_input_add

我尝试了一些搜索,但是我发现的唯一相关页面是https://supportforums.motorola.com/message/513190,并没有多大帮助。

是否有其他人遇到类似问题或找到解决方法?

3 个答案:

答案 0 :(得分:8)

我们遇到了同样的错误,至少在我们的情况下,结果是由于在加载与该布局相关联的图像时内存不足。布局本身似乎是摩托罗拉为警报对话做的一些剥皮事情(我的假设)。我发现它的唯一方法是OutOfMemoryError是我们的质量检查测试人员在遇到崩溃时生成了一个adb bug报告,我可以在尝试解码图像时看到bug报告中的OutOfMemoryError(在堆栈跟踪的同一个线程上)生成了。)

答案 1 :(得分:1)

摩托罗拉手机非常烦人,有时可能很有用。 我以前只有摩托罗拉手机才能在谷歌地图上显示当前位置图标。他们解决了ICS升级的问题,因此我花费的所有努力和时间来弄清楚问题。 现在,当打开警报对话框时,我遇到了与某些用户完全相同的问题。 最糟糕的是,我无法使用同一部手机重现这一点,用户报告错误的操作系统相同。

答案 2 :(得分:-2)

您在警告对话框中尝试此类型代码

{
myDialog = new Dialog(context);
myDialog.setContentView(R.layout.addfence_dialog);
myDialog.setTitle("EditFence");
myDialog.setCancelable(true);

strTitle = (EditText) myDialog.findViewById(R.id.add_dialog_edtTitle);
strArea = (EditText) myDialog.findViewById(R.id.add_dialog_edtArea);
strDescription = (EditText) myDialog.findViewById(R.id.add_dialog_edtDescription);
strTag = (EditText) myDialog.findViewById(R.id.add_dialog_edtTag);

save = (Button) myDialog.findViewById(R.id.add_dialog_btnSave);
cancel = (Button) myDialog.findViewById(R.id.add_dialog_btnCancel);

strTitle.setText(getTitle);
strArea.setText(getArea);
strDescription.setText(getDesc);
strTag.setText(getTag);

save.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
          .....
}
myDialog.show();
}