java - 尽管 Eclipse 中的一切都正确,但 Android ActivityNotFoundException

标签 java android eclipse

我使用最新的 Android 工具在 Eclipse 3.8 中创建了这个最简单的服务项目(基于 this )并将其发布在这里: https://github.com/8enmann/hello-service/

启动时出现以下错误:

02-03 00:18:45.984: E/AndroidRuntime(20145): java.lang.RuntimeException:
Unable to start activity ComponentInfo{net.softmann/net.softmann.HelloActivity}:
android.content.ActivityNotFoundException: 
Unable to find explicit activity class {net.softmann/net.softmann.HelloService}; 
have you declared this activity in your AndroidManifest.xml?

但它在我的 list 中!我究竟做错了什么?我也尝试过使用“net.softmann.HelloService”而不是“.HelloService”,但仍然没有成功。

最佳答案

异常表明您正在尝试启动 Activity net.softmann/net.softmann.HelloService 但未找到该 Activity 。

查看您的 list 文件,您有一个具有此类名称的服务

查看您的 Activity 代码,您已经

startActivity(new Intent(getApplicationContext(), HelloService.class));

使用 startService() 启动服务,而不是 startActivity()

关于java - 尽管 Eclipse 中的一切都正确,但 Android ActivityNotFoundException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21522589/

相关文章:

java - Do While 循环,更新最大捐赠者的姓名

java - 退出 Activity 时终止线程(android)

android - 在android中创建iPhone风格的气泡 ListView

java - 仅在Eclipse中将带有捆绑的外部jar添加到项目中

java - Elasticsearch match_pharse 查询无法正常工作

java - Android - 在 ImageView 中交叉淡化多个图像

java - Netbeans 中的 StdIn 库 - StdIn.readInt()

Android 布局——在一个 ListView 行中垂直堆叠两个 TextView

eclipse - Eclipse 中 Ant Include 任务的错误错误消息

c - 如何自定义eclipse clean project 功能?