Music打开出错

 一打开就报错,类似“   

Android: android.content.res.Resources$NotFoundException: Resource ID #0x7f030009

 ”
google找到一篇: https://bugs.launchpad.net/linaro-android/+bug/772528

Ok I updated bug heading and here's a list of apps which crash:

* Contacts
* Music
* Phone (seems due to Contacts)

Stack traces below:

E/AndroidRuntime( 1452): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.contacts/com.android.contacts.DialtactsActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f03000e
E/AndroidRuntime( 1452): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
E/AndroidRuntime( 1452): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
E/AndroidRuntime( 1452): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
E/AndroidRuntime( 1452): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
E/AndroidRuntime( 1452): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1452): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime( 1452): at android.app.ActivityThread.main(ActivityThread.java:3683)
E/AndroidRuntime( 1452): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1452): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 1452): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime( 1452): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime( 1452): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 1452): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f03000e
E/AndroidRuntime( 1452): at android.content.res.Resources.getValue(Resources.java:892)
E/AndroidRuntime( 1452): at android.content.res.Resources.loadXmlResourceParser(Resources.java:1869)
E/AndroidRuntime( 1452): at android.content.res.Resources.getLayout(Resources.java:731)
E/AndroidRuntime( 1452): at android.view.LayoutInflater.inflate(LayoutInflater.java:318)
E/AndroidRuntime( 1452): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
E/AndroidRuntime( 1452): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
E/AndroidRuntime( 1452): at android.app.Activity.setContentView(Activity.java:1657)
E/AndroidRuntime( 1452): at com.android.contacts.DialtactsActivity.onCreate(DialtactsActivity.java:69)
E/AndroidRuntime( 1452): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime( 1452): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
E/AndroidRuntime( 1452): ... 11 more

E/AndroidRuntime( 1484): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.music/com.android.music.ArtistAlbumBrowserActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f030009
E/AndroidRuntime( 1484): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
E/AndroidRuntime( 1484): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
E/AndroidRuntime( 1484): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
E/AndroidRuntime( 1484): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
E/AndroidRuntime( 1484)...

其中,网址:

http://git.linaro.org/gitweb?p=android/device/linaro/common.git;a=commitdiff;h=89a3940ca2ad04a54e4a8aa315f0089ce4621d17;hp=cc108a6396661b453085fd4be7011f69acf52d87

这里有个commit解决这个问题,是由于系统中没有touch设备,而Music需要检测系统中存在touch设备

才能工作。

From 89a3940ca2ad04a54e4a8aa315f0089ce4621d17 Mon Sep 17 00:00:00 2001
From: Jim Huang <jim.huang@linaro.org>
Date: Wed, 29 Jun 2011 01:22:52 +0800
Subject: [PATCH 1/1] [LINARO] Add fake touchscreen 'driver' to avoid Android activity crash

Some Android activities like 'Music' expect the presence of touchscreen
device, otherwise they would crash due to lacking of corresponding
system resources.

To fix the crash, a fake touchscreen 'driver' is added, which utilizes
uinput to register a touchscreen device in kernel.
---
 fake-ts/Android.mk |   30 ++++++++++++++++++++
 fake-ts/fake-ts.c  |   76 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 106 insertions(+), 0 deletions(-)
 create mode 100644 fake-ts/Android.mk
 create mode 100644 fake-ts/fake-ts.c

diff --git a/fake-ts/Android.mk b/fake-ts/Android.mk
new file mode 100644
index 0000000..3c3ba4c
--- /dev/null
+++ b/fake-ts/Android.mk
@@ -0,0 +1,30 @@
+# Copyright (C) 2011 Linaro Limited
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+ifneq ($(TARGET_SIMULATOR),true)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := faketsd
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := fake-ts.c
+LOCAL_PRELINK_MODULE := false
+
+include $(BUILD_EXECUTABLE)
+
+endif # !TARGET_SIMULATOR
diff --git a/fake-ts/fake-ts.c b/fake-ts/fake-ts.c
new file mode 100644
index 0000000..9fe0a20
--- /dev/null
+++ b/fake-ts/fake-ts.c
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2011 Linaro Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ */
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <linux/uinput.h>
+
+/* look up source file system/core/init/devices.c for exact node */
+#define UINPUT_DEV "/dev/uinput"
+
+#define DEV_NAME "Fake Touchscreen"
+
+static int uinput_fd = 0;
+
+static void uinput_touch_init(const char* uinput_dev,
+                              const char* dev_name)
+{
+    struct uinput_user_dev dev;
+
+    uinput_fd = open(uinput_dev, O_WRONLY);
+    if (uinput_fd <= 0) {
+        perror("Error opening uinput device.\n");
+        return;
+    }
+    memset(&dev, 0, sizeof(dev));
+    strcpy(dev.name, dev_name);
+    write(uinput_fd, &dev, sizeof(dev));
+
+    /* touch screen event */
+    ioctl(uinput_fd, UI_SET_EVBIT, EV_ABS);
+    ioctl(uinput_fd, UI_SET_ABSBIT, ABS_X);
+    ioctl(uinput_fd, UI_SET_ABSBIT, ABS_Y);
+    ioctl(uinput_fd, UI_SET_EVBIT, EV_KEY);
+    ioctl(uinput_fd, UI_SET_KEYBIT, BTN_TOUCH);
+
+    /* register userspace input device */
+    ioctl(uinput_fd, UI_DEV_CREATE, 0);
+}
+
+static void uinput_touch_deinit()
+{
+    if (uinput_fd > 0) {
+        close(uinput_fd);
+    }
+}
+
+int main(int argc, char* argv[])
+{
+    uinput_touch_init(UINPUT_DEV, DEV_NAME);
+
+    while (1) {
+        sleep(60);
+    }
+
+    uinput_touch_deinit();
+
+    return 0;
+}
+
-- 
1.7.0.4
或者简单点的办法,直接在kernel中选择一个touch的driver,哪怕用不到。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值