Android HelloTab 教程
我是一名经验丰富的 Java 程序员,刚刚开始从事 Android 开发。我正在浏览教程,但在使用选项卡小部件教程时遇到问题。我严格按照示例进行操作,并在尝试在模拟器上运行时不断在日志中获取以下内容:
ActivityManager: 启动: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.android/.HelloTabWidget }
ActivityManager: java.lang.SecurityException:权限拒绝:从 null 开始 Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.android/.HelloTabWidget } (pid=-1, uid=-1 ) 需要 null
我在过去三个小时内搜索了互联网论坛,但找不到任何关于正在发生的事情的答案。我正在使用的教程在这里:http://developer.android。 com/resources/tutorials/views/hello-tabwidget.html。我使用的是jre 1.6,Android平台2.1。任何帮助将不胜感激。我无法告诉你,当你遵循一个简单的例子却无法让它工作时,这是多么令人沮丧。
I am an experienced Java programmer just starting out with Android development. I am going through the tutorials and am having a problem with the tab widget tutorial. I have followed the example to the letter and keep getting the below in the log when trying to run on the emulator:
ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.android/.HelloTabWidget }
ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.android/.HelloTabWidget } from null (pid=-1, uid=-1) requires null
I have searched the internet forums for the last three hours and can't find any answers to what is going on. The tutorial I am using is here: http://developer.android.com/resources/tutorials/views/hello-tabwidget.html. I am using jre 1.6, and Android platform 2.1. Any help will be appreciated. I can't tell you how frustrating it is when you follow a supposed simple example and you can't get it to work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您仍然遇到问题并且您已尝试了上述所有方法...
最后一次尝试是:
确保您的目标 SDK 和 ADT 与所需的 SDK 和 ADT 版本匹配...这肯定会有所帮助。我的项目正在寻找 API 8,而我有 API 14。所以我已经安装了 API 8 版本和 ADT8.X 版本...
If you are still having issues and you have tried all that is mentioned above...
Last try is:
Make sure your target SDK and ADT matches the required SDK and ADT version...This will surely help. My project is looking for API 8 and I have API 14. So I have installed API 8 version with ADT8.X version...
如果没有完成这个特定的教程,我会说,在我有限的经验中,Android 中权限拒绝错误的主要原因是未能 在 AndroidManifest.xml 文件中声明必要的权限。但我不确定这里的情况是否如此。
这可能是一个转移注意力的话题,但您的应用程序的名称看起来不正确。看起来你已经将它命名为 Android 系统应用程序(我只在 Android 系统应用程序中见过包前缀“com.android”)。也许如果您尝试在项目中的包字段中添加“com.android”以外的其他内容,这可能会有所帮助,因为命名空间可能受到保护。
Without having done this particular tutorial, I'll say that the main reason for permission denial errors in Android in my limited experience is failure to declare necessary permissions in the AndroidManifest.xml file. I'm not sure that this is the case here though.
This may be a red herring, but the name of your application doesn't look right. It looks like you've named it as if it's an android system application (the package prefix "com.android" I've only seen with regard to Android system apps). Maybe if you tried putting something other than "com.android" for the package field in your project this might help, because it could be that the namespace is protected.