【异常解决】android.content.ActivityNotFoundException: Unable to find explicit activity class
来源:互联网 发布:成都焚烧汉服事件知乎 编辑:程序博客网 时间:2024/04/29 06:29
异常:
01-01 16:19:13.269: E/AndroidRuntime(2969): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.x210.communication/com.x210.communication.SubActivity};have you declared this activity in your AndroidManifest.xml?
问题呈现:
@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);textView = (TextView) findViewById(R.id.textShow);final Button btn1 = (Button) findViewById(R.id.btn1);btn1.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {Intent intent = new Intent(ActivityCommunication.this,SubActivity.class);startActivity(intent);//从当前Activity跳转到SubActivity}});}
AndroidManifest.xml<application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:label="@string/app_name" android:name=".ActivityCommunication" > <intent-filter > <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application>
问题解决:
其实可以根据错误提示:have you declared this activity in your AndroidManifest.xml? 知道错误根源是在清单文件中没有注册Activity;
在AndroidManifest.xml的<application></application>节点中添加如下注册代码即可:
<activity android:name =".SubActivity"/>
- 【异常解决】android.content.ActivityNotFoundException: Unable to find explicit activity class
- Android 异常解决 content.ActivityNotFoundException: Unable to find explicit activity class
- android.content.ActivityNotFoundException: Unable to find explicit activity class 【安卓报错】
- android.content.ActivityNotFoundException: Unable to find explicit activity class
- android.content.ActivityNotFoundException: Unable to find explicit activity class(安卓报错)
- android.content.ActivityNotFoundException: Unable to find explicit activity class
- android.content.ActivityNotFoundException: Unable to find explicit activity class解决办法
- android.content.ActivityNotFoundException: Unable to find explicit activity
- Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class
- android.content.ActivityNotFoundException: Unable to find explicit activity class {...}; have you de
- android.content.ActivityNotFoundException: Unable to find explicit activity class错误原因排查
- ActivityNotFoundException: Unable to find explicit activity class
- Android开发问题:ActivityNotFoundException: Unable to find explicit activity class
- Android开发Exception:ActivityNotFoundException: Unable to find explicit activity class
- Android错误:unable to find explicit activity class
- Unable to find explicit activity class
- Unable to find explicit activity class
- Unable to find explicit activity class
- 创建索引
- 【Linux基础】面向连接的套接字通信(TCP)之函数说明
- 关于struts 2为什么会有代码执行漏洞的小帖子
- Kconfig
- 【转】C#调用C++DLL 数据类型转换
- 【异常解决】android.content.ActivityNotFoundException: Unable to find explicit activity class
- LINUX文件系统
- MySQL5.0版本的安装图解【转】
- Android应用程序键盘(Keyboard)消息处理机制分析
- java中list排序(元素为对象)
- (Python学习9)Python虚拟机中的一般表达式
- 【Linux基础】面向连接的套接字通信(TCP)之函数格式
- 关于临接表2种方式实现的测验(Adjacency List)
- 数据结构--链队列的基本操作