Android(java)学习笔记123:Clock app编写报错01
1. 首先我们二话不说直接先看报错内容如下:
07-12 08:25:03.572: E/dalvikvm(3602): native fork pid:0 done.
07-12 08:25:03.582: E/dalvikvm(3602): threadid=6: created from interp,name=ReferenceQueueDaemon
07-12 08:25:03.582: E/dalvikvm(3602): threadid=6: calling run(),name=ReferenceQueueDaemon
07-12 08:25:03.582: E/dalvikvm(3602): threadid=7: created from interp,name=FinalizerDaemon
07-12 08:25:03.582: E/dalvikvm(3602): threadid=7: calling run(),name=FinalizerDaemon
07-12 08:25:03.592: E/dalvikvm(3602): threadid=8: created from interp,name=FinalizerWatchdogDaemon
07-12 08:25:03.592: E/dalvikvm(3602): threadid=8: calling run(),name=FinalizerWatchdogDaemon
07-12 08:25:03.642: D/ActivityThread(3602): setTargetHeapUtilization:0.25
07-12 08:25:03.642: D/ActivityThread(3602): setTargetHeapIdealFree:8388608
07-12 08:25:03.642: D/ActivityThread(3602): setTargetHeapConcurrentStart:2097152
07-12 08:25:03.662: I/System.out(3602): Sending WAIT chunk
07-12 08:25:03.662: W/ActivityThread(3602): Application com.himi.clock is waiting for the debugger on port 8100...
07-12 08:25:05.253: I/System.out(3602): Debugger has connected
07-12 08:25:05.253: I/System.out(3602): waiting for debugger to settle...
07-12 08:25:05.454: I/System.out(3602): waiting for debugger to settle...
07-12 08:25:05.654: I/System.out(3602): waiting for debugger to settle...
07-12 08:25:05.854: I/System.out(3602): waiting for debugger to settle...
07-12 08:25:06.054: I/System.out(3602): waiting for debugger to settle...
07-12 08:25:06.254: I/System.out(3602): waiting for debugger to settle...
07-12 08:25:06.455: I/System.out(3602): waiting for debugger to settle...
07-12 08:25:06.655: I/System.out(3602): waiting for debugger to settle...
07-12 08:25:06.855: I/System.out(3602): waiting for debugger to settle...
07-12 08:25:07.055: I/System.out(3602): waiting for debugger to settle...
07-12 08:25:07.256: I/System.out(3602): debugger has settled (1411)
07-12 08:26:55.171: D/ActivityThread(4159): setTargetHeapUtilization:0.25
07-12 08:26:55.171: D/ActivityThread(4159): setTargetHeapIdealFree:8388608
07-12 08:26:55.171: D/ActivityThread(4159): setTargetHeapConcurrentStart:2097152
07-12 08:26:55.391: W/dalvikvm(4159): threadid=1: thread exiting with uncaught exception (group=0x416cd498)
07-12 08:26:55.391: E/AndroidRuntime(4159): FATAL EXCEPTION: main
07-12 08:26:55.391: E/AndroidRuntime(4159): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.himi.clock/com.himi.clock.MainActivity}: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.himi.clock/com.himi.clock.ClockActivity}; have you declared this activity in your AndroidManifest.xml?
07-12 08:26:55.391: E/AndroidRuntime(4159): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2092)
07-12 08:26:55.391: E/AndroidRuntime(4159): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2117)
07-12 08:26:55.391: E/AndroidRuntime(4159): at android.app.ActivityThread.access$600(ActivityThread.java:140)
07-12 08:26:55.391: E/AndroidRuntime(4159): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1213)
07-12 08:26:55.391: E/AndroidRuntime(4159): at android.os.Handler.dispatchMessage(Handler.java:99)
07-12 08:26:55.391: E/AndroidRuntime(4159): at android.os.Looper.loop(Looper.java:137)
07-12 08:26:55.391: E/AndroidRuntime(4159): at android.app.ActivityThread.main(ActivityThread.java:4914)
07-12 08:26:55.391: E/AndroidRuntime(4159): at java.lang.reflect.Method.invokeNative(Native Method)
07-12 08:26:55.391: E/AndroidRuntime(4159): at java.lang.reflect.Method.invoke(Method.java:511)
07-12 08:26:55.391: E/AndroidRuntime(4159): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:808)
07-12 08:26:55.391: E/AndroidRuntime(4159): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:575)
07-12 08:26:55.391: E/AndroidRuntime(4159): at dalvik.system.NativeStart.main(Native Method)
07-12 08:26:55.391: E/AndroidRuntime(4159): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.himi.clock/com.himi.clock.ClockActivity}; have you declared this activity in your AndroidManifest.xml?
07-12 08:26:55.391: E/AndroidRuntime(4159): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1541)
07-12 08:26:55.391: E/AndroidRuntime(4159): at android.app.ActivityThread.resolveActivityInfo(ActivityThread.java:1903)
07-12 08:26:55.391: E/AndroidRuntime(4159): at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:285)
07-12 08:26:55.391: E/AndroidRuntime(4159): at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:694)
07-12 08:26:55.391: E/AndroidRuntime(4159): at android.widget.TabHost.setCurrentTab(TabHost.java:358)
07-12 08:26:55.391: E/AndroidRuntime(4159): at android.widget.TabHost.addTab(TabHost.java:236)
07-12 08:26:55.391: E/AndroidRuntime(4159): at com.himi.clock.MainActivity.addOneTab(MainActivity.java:32)
07-12 08:26:55.391: E/AndroidRuntime(4159): at com.himi.clock.MainActivity.onCreate(MainActivity.java:20)
07-12 08:26:55.391: E/AndroidRuntime(4159): at android.app.Activity.performCreate(Activity.java:5086)
07-12 08:26:55.391: E/AndroidRuntime(4159): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
07-12 08:26:55.391: E/AndroidRuntime(4159): at com.lbe.security.service.core.client.b.x.callActivityOnCreate(Unknown Source)
07-12 08:26:55.391: E/AndroidRuntime(4159): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2056)
07-12 08:26:55.391: E/AndroidRuntime(4159): ... 11 more
07-12 08:34:04.128: D/ActivityThread(6074): setTargetHeapUtilization:0.25
07-12 08:34:04.128: D/ActivityThread(6074): setTargetHeapIdealFree:8388608
07-12 08:34:04.128: D/ActivityThread(6074): setTargetHeapConcurrentStart:2097152
07-12 08:34:04.379: W/dalvikvm(6074): threadid=1: thread exiting with uncaught exception (group=0x416cd498)
07-12 08:34:04.389: E/AndroidRuntime(6074): FATAL EXCEPTION: main
07-12 08:34:04.389: E/AndroidRuntime(6074): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.himi.clock/com.himi.clock.MainActivity}: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.himi.clock/com.himi.clock.ClockActivity}; have you declared this activity in your AndroidManifest.xml?
07-12 08:34:04.389: E/AndroidRuntime(6074): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2092)
07-12 08:34:04.389: E/AndroidRuntime(6074): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2117)
07-12 08:34:04.389: E/AndroidRuntime(6074): at android.app.ActivityThread.access$600(ActivityThread.java:140)
07-12 08:34:04.389: E/AndroidRuntime(6074): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1213)
07-12 08:34:04.389: E/AndroidRuntime(6074): at android.os.Handler.dispatchMessage(Handler.java:99)
07-12 08:34:04.389: E/AndroidRuntime(6074): at android.os.Looper.loop(Looper.java:137)
07-12 08:34:04.389: E/AndroidRuntime(6074): at android.app.ActivityThread.main(ActivityThread.java:4914)
07-12 08:34:04.389: E/AndroidRuntime(6074): at java.lang.reflect.Method.invokeNative(Native Method)
07-12 08:34:04.389: E/AndroidRuntime(6074): at java.lang.reflect.Method.invoke(Method.java:511)
07-12 08:34:04.389: E/AndroidRuntime(6074): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:808)
07-12 08:34:04.389: E/AndroidRuntime(6074): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:575)
07-12 08:34:04.389: E/AndroidRuntime(6074): at dalvik.system.NativeStart.main(Native Method)
07-12 08:34:04.389: E/AndroidRuntime(6074): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.himi.clock/com.himi.clock.ClockActivity}; have you declared this activity in your AndroidManifest.xml?
07-12 08:34:04.389: E/AndroidRuntime(6074): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1541)
07-12 08:34:04.389: E/AndroidRuntime(6074): at android.app.ActivityThread.resolveActivityInfo(ActivityThread.java:1903)
07-12 08:34:04.389: E/AndroidRuntime(6074): at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:285)
07-12 08:34:04.389: E/AndroidRuntime(6074): at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:694)
07-12 08:34:04.389: E/AndroidRuntime(6074): at android.widget.TabHost.setCurrentTab(TabHost.java:358)
07-12 08:34:04.389: E/AndroidRuntime(6074): at android.widget.TabHost.addTab(TabHost.java:236)
07-12 08:34:04.389: E/AndroidRuntime(6074): at com.himi.clock.MainActivity.addOneTab(MainActivity.java:32)
07-12 08:34:04.389: E/AndroidRuntime(6074): at com.himi.clock.MainActivity.onCreate(MainActivity.java:20)
07-12 08:34:04.389: E/AndroidRuntime(6074): at android.app.Activity.performCreate(Activity.java:5086)
07-12 08:34:04.389: E/AndroidRuntime(6074): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
07-12 08:34:04.389: E/AndroidRuntime(6074): at com.lbe.security.service.core.client.b.x.callActivityOnCreate(Unknown Source)
07-12 08:34:04.389: E/AndroidRuntime(6074): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2056)
07-12 08:34:04.389: E/AndroidRuntime(6074): ... 11 more
仔细阅读红色字体处的报错信息知道:原来是我编写的APP中含有的多个Activity,必须要在AndroidManifest.xml中进行声明,声明如下:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.himi.clock"
android:versionCode="1"
android:versionName="1.0" > <uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="17" /> <application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity> <activity android:name=".ClockActivity" />
<activity android:name=".StopwatchActivity" />
<activity android:name=".TimerActivity" />
</application> </manifest>
再次加载程序到手机里面,发现这时候是可以运行的,没有报错了
那么为什么要这样在AndroidManifest.xml声明注册多个activity???
答:我们知道不同activity代表不同的窗口界面,Android系统只有先注册了不同的activity,系统内部才能对它操作,比如利用intent操作。
Android(java)学习笔记123:Clock app编写报错01的更多相关文章
- Android(java)学习笔记63:Clock App 编写报错01
1. 首先我们二话不说直接先看报错内容如下: 07-12 08:25:03.572: E/dalvikvm(3602): native fork pid:0 done. 07-12 08:25:03. ...
- Android(java)学习笔记125:Clock app编写报错02
1.首先之间看错误: 07-13 10:07:55.354: E/AndroidRuntime(8008): FATAL EXCEPTION: main 07-13 10:07:55.354: E/A ...
- Android(java)学习笔记65:Clock App 编写报错02
1. 首先之间看错误: 07-13 10:07:55.354: E/AndroidRuntime(8008): FATAL EXCEPTION: main 07-13 10:07:55.354: E/ ...
- Android 解决Execution failed for task ':app:clean.'报错
说实话,我还真是没见过比Execution failed for task ':app:clean.'更为恶心,更为不要脸的bug啦,代码没啥问题,一下子行让你爽爽,一下子又不鸟你啦,研究了下,终于找 ...
- Android自动化学习笔记:编写MonkeyRunner脚本的几种方式
---------------------------------------------------------------------------------------------------- ...
- 《Java学习笔记(第8版)》学习指导
<Java学习笔记(第8版)>学习指导 目录 图书简况 学习指导 第一章 Java平台概论 第二章 从JDK到IDE 第三章 基础语法 第四章 认识对象 第五章 对象封装 第六章 继承与多 ...
- Java学习笔记4
Java学习笔记4 1. JDK.JRE和JVM分别是什么,区别是什么? 答: ①.JDK 是整个Java的核心,包括了Java运行环境.Java工具和Java基础类库. ②.JRE(Java Run ...
- 20145316许心远《Java学习笔记(第8版)》课程总结
20145316许心远<Java学习笔记(第8版)>课程总结 每周读书笔记链接汇总 ▪ 第一周读书笔记 ▪ 第二周读书笔记 ▪ 第三周读书笔记 ▪ 第四周读书笔记 ▪ 第五周读书笔记 ▪ ...
- Android:日常学习笔记(6)——探究活动(4)
Android:日常学习笔记(6)——探究活动(4) 活动的启动模式 standard模式 standard是活动默认的启动模式,在不进行显示定义的情况下,所有活动都会自动使用这种启动模式. stan ...
随机推荐
- MySQL table_id原理及风险分析
1. 什么是table_id MySQL binlog文件按格式分为文件头部和事件信息.文件头部占4字节,内容固定为:"\xfe\x62\x69\x6e",接下来就是各个event ...
- (转载)static全局变量与普通的全局变量有什么区别?
(转载)http://www.cnblogs.com/StudyRush/archive/2010/09/25/1834922.html 全局变量(外部变量)的说明之前再冠以static 就构成了静态 ...
- 编程精粹:编写高质量的C语言代码———笔记一
第一章 假想的编译程序 要记得对空语句进行处理,最好使用NULL使其明显可见 char * strcpy(char* pchTo, char* pchFrom) { char* pchStart = ...
- 【JMeter】ant+jmeter生成html报告
源博文来自于 http://my.oschina.net/hellotest/blog/517518 主要应用于接口的回归或者性能的简单查看功能.操作为先在jmeter中写好测试计划,保存为jmx文 ...
- 设计模式_C++源码+总结
C++源码下载: http://yunpan.cn/Q7fadjGgEJxib 提取码 63cb 总结:
- IO 图
- “Clean Code” 读书笔记序
最近开始研读 Robert C.Martin 的 “Clean Code”,为了巩固学习,会把每一章的笔记整理到博客中.而这篇博文作为一个索引和总结,会陆续加入各章的笔记链接,以及全部读完后的心得体会 ...
- uva 11168
题意:给出平面上的n个点,求一条直线,使得所有点在该直线的同一侧且所有点到该直线的距离和最小,输出该距离和. 思路:要使所有点在该直线的同一侧,明显是直接利用凸包的边更优.所以枚举凸包的没条边,然后求 ...
- 集群搭建必备:虚拟机之一实现Host-only方式上网
Host-only模式实现联网得考虑如下配置过程: 1. 安装VMware-Workstation,安装虚拟机Linux(centos.ubuntu等)完毕: 2.设置虚拟机上网方式是Host-onl ...
- android AudioRecord 与 AudioTrack的录音加回放的使用
http://stackoverflow.com/questions/32682952/audiotrack-audiotack-not-playing-fully-recorded-audio