[转载]have you declared this activity in your AndroidManifest.xml? – Neo的日志 – 网易博客.
I/ActivityManager( 1128): Displayed com.Android.settings/.WirelessSettings: +1s116ms
I/ActivityManager( 1128): Starting: Intent { act=Android.intent.action.MAIN cmp=com.rockchip.ethernetsettings/.EthernetSettings } from pid 2371
D/AndroidRuntime( 2371): Shutting down VM
W/dalvikvm( 2371): threadid=1: thread exiting with uncaught exception (group=0xa00194f0)
E/AndroidRuntime( 2371): FATAL EXCEPTION: main
E/AndroidRuntime( 2371): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.rockchip.ethernetsettings/com.rockchip.ethernetsettings.EthernetSettings}; have you declared this activity in your AndroidManifest.xml?
E/AndroidRuntime( 2371): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1404)
E/AndroidRuntime( 2371): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
E/AndroidRuntime( 2371): at android.app.Activity.startActivityForResult(Activity.java:2827)
E/AndroidRuntime( 2371): at android.app.Activity.startActivity(Activity.java:2933)
E/AndroidRuntime( 2371): at android.preference.Preference.performClick(Preference.java:828)
E/AndroidRuntime( 2371): at android.preference.PreferenceScreen.onItemClick(PreferenceScreen.java:190)
E/AndroidRuntime( 2371): at android.widget.AdapterView.performItemClick(AdapterView.java:284)
E/AndroidRuntime( 2371): at android.widget.ListView.performItemClick(ListView.java:3513)
E/AndroidRuntime( 2371): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1800)
E/AndroidRuntime( 2371): at android.os.Handler.handleCallback(Handler.java:587)
E/AndroidRuntime( 2371): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 2371): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 2371): at android.app.ActivityThread.main(ActivityThread.java:3647)
E/AndroidRuntime( 2371): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 2371): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 2371): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime( 2371): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime( 2371): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 1128): Force finishing activity com.android.settings/.WirelessSettings
W/ActivityManager( 1128): Activity pause timeout for HistoryRecord{a0674e28 com.android.settings/.WirelessSettings}
D/dalvikvm( 1128): GC_CONCURRENT freed 698K, 47% free 4162K/7751K, external 1639K/1975K, paused 12ms+12ms
I/Process ( 2371): Sending signal. PID: 2371 SIG: 9
I/ActivityManager( 1128): Process com.android.settings (pid 2371) has died.
其中解决问题的关键在于
E/AndroidRuntime( 2371): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.rockchip.ethernetsettings/com.rockchip.ethernetsettings.EthernetSettings}; have you declared this activity in your AndroidManifest.xml?
这个信息。寻找项目对应的AndroidManifest.xml,这个文件存在且正确。而且com.rockchip.ethernetsettings.EthernetSettings这个类的代码也在。
这 个错误信息可以理解为,android编译之后会将所有的AndroidManifest.xml组成一个表,在点击相应item的时候触发响应的过程是 通过item的name去这个表中找相应的类名,找到类名后,就调用这个类。而以上出错信息提示未找到这个类。怀疑这个类是否真的被编译进镜像了。查看 android.mk文件,
ifeq ($(strip $(USE_ETHERNET)),true)
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := eng
LOCAL_SRC_FILES := $(call all-subdir-java-files)
LOCAL_PACKAGE_NAME := EthernetSettings
LOCAL_CERTIFICATE := platform
include $(BUILD_PACKAGE)
endif
发现第一行的宏并没有被定义,在适当的地方添加即可。这里在device/seuic/tiger_mb/device.mk中添加如下:
# Ethernet +++
USE_ETHERNET := true
# Ethernet —
重新编译,问题解决。