gpt4 book ai didi

安卓记事本教程1 : Crash when I click on "Menu"

转载 作者:行者123 更新时间:2023-11-29 02:11:48 24 4
gpt4 key购买 nike

我是 Android 的初学者,NotePad 教程(练习 1)有一个奇怪的错误。 http://developer.android.com/resources/tutorials/notepad/index.html

我导入了源代码并完成了代码,但是当我运行应用程序并单击“菜单”按钮时,它崩溃了(应用程序....意外停止。请重试。)

然后,我导入了解决方案,它运行正常。

我将解决方案中的整个代码、资源、 list 复制到第一个项目...仍然,第一个项目的一切都很好,但是当我单击“菜单”时,我遇到了同样的崩溃。

谁能解释我哪里出错了?

经过一些研究,我打开了 LogCat。以下是看起来很有趣的几行:

Displayed activity com.android.demo.notepad1/.Notepadv1: 1261 ms (total 1261 ms)
No keyboard for id 0

Using default keymap: /system/usr/keychars/qwerty.kcm.bin

getEntry failing because entryIndex 2 is beyond type entryCount 2

Failure getting entry for 0x7f040002 (t=3 e=2) in package 0: 0x80000001

Shutting down VM

threadid=3: thread exiting with uncaught exception (group=0x4001b188)

Uncaught handler: thread main exiting due to uncaught exception

android.content.res.Resources$NotFoundException: String resource ID #0x7f040002

我注意到 0x7f040002 指的是 R.java 中的 "menu_insert" 字符串

最佳答案

我唯一的猜测是 R.java 没有正确刷新。您是否在 Eclipse 中尝试过项目>清理?这将重新创建 R.java 文件。

关于安卓记事本教程1 : Crash when I click on "Menu",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6818581/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com