我在所有活动中为相同的菜单充气,这在所有活动和设备中都非常好用。 最近我将Google nexus升级为亲爱的梳子,现在,我面临一个奇怪的错误 - 菜单在所有活动中都被打开,而不是一个活动。 导致资源未找到。
DDMS:
04-19 16:03:46.250: E/AndroidRuntime(4269): FATAL EXCEPTION: main
04-19 16:03:46.250: E/AndroidRuntime(4269): android.content.res.Resources$NotFoundException: Resource ID #0x1090045
04-19 16:03:46.250: E/AndroidRuntime(4269): at android.content.res.Resources.getValue(Resources.java:1018)
04-19 16:03:46.250: E/AndroidRuntime(4269): at android.content.res.Resources.loadXmlResourceParser(Resources.java:2105)
04-19 16:03:46.250: E/AndroidRuntime(4269): at android.content.res.Resources.getLayout(Resources.java:857)
04-19 16:03:46.250: E/AndroidRuntime(4269): at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
04-19 16:03:46.250: E/AndroidRuntime(4269): at com.android.internal.view.menu.BaseMenuPresenter.getMenuView(BaseMenuPresenter.java:70)
04-19 16:03:46.250: E/AndroidRuntime(4269): at com.android.internal.policy.impl.PhoneWindow$PanelFeatureState.getIconMenuView(PhoneWindow.java:3320)
04-19 16:03:46.250: E/AndroidRuntime(4269): at com.android.internal.policy.impl.PhoneWindow.initializePanelContent(PhoneWindow.java:1096)
04-19 16:03:46.250: E/AndroidRuntime(4269): at com.android.internal.policy.impl.PhoneWindow.openPanel(PhoneWindow.java:559)
04-19 16:03:46.250: E/AndroidRuntime(4269): at com.android.internal.policy.impl.PhoneWindow.onKeyUpPanel(PhoneWindow.java:817)
04-19 16:03:46.250: E/AndroidRuntime(4269): at com.android.internal.policy.impl.PhoneWindow.onKeyUp(PhoneWindow.java:1486)
04-19 16:03:46.250: E/AndroidRuntime(4269): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1813)
04-19 16:03:46.250: E/AndroidRuntime(4269): at android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:3327)
04-19 16:03:46.250: E/AndroidRuntime(4269): at android.view.ViewRootImpl.handleFinishedEvent(ViewRootImpl.java:3300)
04-19 16:03:46.250: E/AndroidRuntime(4269): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2460)
04-19 16:03:46.250: E/AndroidRuntime(4269): at android.os.Handler.dispatchMessage(Handler.java:99)
04-19 16:03:46.250: E/AndroidRuntime(4269): at android.os.Looper.loop(Looper.java:137)
04-19 16:03:46.250: E/AndroidRuntime(4269): at android.app.ActivityThread.main(ActivityThread.java:4424)
04-19 16:03:46.250: E/AndroidRuntime(4269): at java.lang.reflect.Method.invokeNative(Native Method)
04-19 16:03:46.250: E/AndroidRuntime(4269): at java.lang.reflect.Method.invoke(Method.java:511)
04-19 16:03:46.250: E/AndroidRuntime(4269): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-19 16:03:46.250: E/AndroidRuntime(4269): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-19 16:03:46.250: E/AndroidRuntime(4269): at dalvik.system.NativeStart.main(Native Method)
04-19 16:03:46.257: W/ActivityManager(134): Force finishing activity com.supervalu.mobile.android/.CoupanViewActivity
04-19 16:03:46.781: W/ActivityManager(134): Activity pause timeout for ActivityRecord{41791d08 com.supervalu.mobile.android/.CoupanViewActivity}
在挖掘资源ID后 - 我发现根本没有声明并将其删除。 即便如此,它在相同的资源ID上显示错误,但现在资源ID指向其他视图。
答案 0 :(得分:0)
通过项目>清理项目;在Eclipse中清除或从命令行清除ant clean
。
此外,因为"蜂蜜梳"不适用于任何可以调用的设备" Google nexus",如果您还有其他问题,请不要感到惊讶。
答案 1 :(得分:0)
有同样的问题,这让我很生气。现在找到解决方案,请参阅https://stackoverflow.com/a/10251279/454667
原来这一行造成了问题:
new Resources(mgr, mMetrics, null);
最后一个参数设置为null。尽管这条线路完全不同。