2

我正在尝试在 Google I/O 的 Hacking Glass 会话中构建要在 Glass 上使用的 Settings.apk:https ://www.youtube.com/watch?feature=player_detailpage&v=OPethpwuYEk#t=500s

他提到,为了使设置 apk 工作,清单中的一行需要修改。这是 AOSP 清单,因为它是:

http://pastebin.com/2yQ3QEgX(由于长度而添加到pastebin)

每次我运行设置应用程序时,它都会崩溃,这是 logcat 输出:

I/PowerManagerService(  184): Auto-brightness: light sensor = 320, brightness = 255
D/Watchdog(  683): Checking for errors
D/dalvikvm(  683): GC_CONCURRENT freed 363K, 43% free 9944K/17223K, paused 3ms+2ms
D/dalvikvm(  683): GC_CONCURRENT freed 382K, 42% free 10074K/17223K, paused 3ms+1ms
D/dalvikvm(  683): GC_CONCURRENT freed 363K, 41% free 10191K/17223K, paused 2ms+2ms
D/dalvikvm(  683): GC_CONCURRENT freed 529K, 42% free 10147K/17223K, paused 4ms+2ms
I/ActivityManager(  184): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cm
p=com.android.settings/.Settings} from pid 4506
D/dalvikvm(  683): GC_CONCURRENT freed 323K, 41% free 10244K/17223K, paused 2ms+2ms
D/dalvikvm(  683): GC_FOR_ALLOC freed 229K, 41% free 10314K/17223K, paused 60ms
I/ActivityManager(  184): Start proc com.android.settings for activity com.android.settings/.Settings: pid=4998 uid=1003
0 gids={1015, 3002, 3001, 3003}
D/OpenGLRenderer(  471): Flushing caches (mode 1)
D/OpenGLRenderer( 4506): Flushing caches (mode 1)
D/OpenGLRenderer( 4506): Flushing caches (mode 0)
W/System.err( 4998): Removed 2131231170
W/System.err( 4998): Removed 2131231177
W/InputManagerService(  184): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Pro
xy@418cfb28 (uid=10029 pid=4506)
D/dalvikvm(  683): GC_CONCURRENT freed 342K, 40% free 10419K/17223K, paused 63ms+3ms
D/LocalBluetoothProfileManager( 4998): LocalBluetoothProfileManager construction complete
D/dalvikvm( 4998): GC_CONCURRENT freed 136K, 3% free 9364K/9607K, paused 2ms+2ms
D/dalvikvm(  683): GC_FOR_ALLOC freed 354K, 39% free 10576K/17223K, paused 23ms
D/libEGL  ( 4998): loaded /system/lib/egl/libGLES_android.so
D/libEGL  ( 4998): loaded /vendor/lib/egl/libEGL_POWERVR_SGX540_120.so
D/libEGL  ( 4998): loaded /vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
D/libEGL  ( 4998): loaded /vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so
D/dalvikvm(  683): GC_CONCURRENT freed 121K, 39% free 10615K/17223K, paused 2ms+4ms
D/dalvikvm(  683): GC_FOR_ALLOC freed 38K, 39% free 10576K/17223K, paused 37ms
I/dalvikvm-heap(  683): Grow heap (frag case) to 11.089MB for 725488-byte allocation
D/OpenGLRenderer( 4998): Enabling debug mode 0
D/BluetoothAdapterStateMachine(  184): BluetoothOn process message: 1
W/BluetoothAdapterStateMachine(  184): BluetoothOn received: 1
D/AndroidRuntime( 4998): Shutting down VM
W/dalvikvm( 4998): threadid=1: thread exiting with uncaught exception (group=0x40d821f8)
D/dalvikvm(  683): GC_FOR_ALLOC freed 472K, 38% free 10812K/17223K, paused 51ms
E/AndroidRuntime( 4998): FATAL EXCEPTION: main
E/AndroidRuntime( 4998): java.lang.NullPointerException
E/AndroidRuntime( 4998):        at com.android.settings.Settings$HeaderAdapter.getView(Settings.java:515)
E/AndroidRuntime( 4998):        at android.widget.AbsListView.obtainView(AbsListView.java:2033)
E/AndroidRuntime( 4998):        at android.widget.ListView.makeAndAddView(ListView.java:1772)
E/AndroidRuntime( 4998):        at android.widget.ListView.fillDown(ListView.java:672)
E/AndroidRuntime( 4998):        at android.widget.ListView.fillFromTop(ListView.java:732)
E/AndroidRuntime( 4998):        at android.widget.ListView.layoutChildren(ListView.java:1625)
E/AndroidRuntime( 4998):        at android.widget.AbsListView.onLayout(AbsListView.java:1863)
E/AndroidRuntime( 4998):        at android.view.View.layout(View.java:11279)
E/AndroidRuntime( 4998):        at android.view.ViewGroup.layout(ViewGroup.java:4224)
E/AndroidRuntime( 4998):        at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1628)
E/AndroidRuntime( 4998):        at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1486)
E/AndroidRuntime( 4998):        at android.widget.LinearLayout.onLayout(LinearLayout.java:1399)
E/AndroidRuntime( 4998):        at android.view.View.layout(View.java:11279)
E/AndroidRuntime( 4998):        at android.view.ViewGroup.layout(ViewGroup.java:4224)
E/AndroidRuntime( 4998):        at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1628)
E/AndroidRuntime( 4998):        at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1617)
E/AndroidRuntime( 4998):        at android.widget.LinearLayout.onLayout(LinearLayout.java:1401)
E/AndroidRuntime( 4998):        at android.view.View.layout(View.java:11279)
E/AndroidRuntime( 4998):        at android.view.ViewGroup.layout(ViewGroup.java:4224)
E/AndroidRuntime( 4998):        at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1628)
E/AndroidRuntime( 4998):        at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1486)
E/AndroidRuntime( 4998):        at android.widget.LinearLayout.onLayout(LinearLayout.java:1399)
E/AndroidRuntime( 4998):        at android.view.View.layout(View.java:11279)
E/AndroidRuntime( 4998):        at android.view.ViewGroup.layout(ViewGroup.java:4224)
E/AndroidRuntime( 4998):        at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
E/AndroidRuntime( 4998):        at android.view.View.layout(View.java:11279)
E/AndroidRuntime( 4998):        at android.view.ViewGroup.layout(ViewGroup.java:4224)
E/AndroidRuntime( 4998):        at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1628)
E/AndroidRuntime( 4998):        at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1486)
E/AndroidRuntime( 4998):        at android.widget.LinearLayout.onLayout(LinearLayout.java:1399)
E/AndroidRuntime( 4998):        at android.view.View.layout(View.java:11279)
E/AndroidRuntime( 4998):        at android.view.ViewGroup.layout(ViewGroup.java:4224)
E/AndroidRuntime( 4998):        at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
E/AndroidRuntime( 4998):        at android.view.View.layout(View.java:11279)
E/AndroidRuntime( 4998):        at android.view.ViewGroup.layout(ViewGroup.java:4224)
E/AndroidRuntime( 4998):        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1498)
E/AndroidRuntime( 4998):        at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2451)
E/AndroidRuntime( 4998):        at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 4998):        at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 4998):        at android.app.ActivityThread.main(ActivityThread.java:4424)
E/AndroidRuntime( 4998):        at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 4998):        at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 4998):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
E/AndroidRuntime( 4998):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
E/AndroidRuntime( 4998):        at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager(  184):   Force finishing activity com.android.settings/.Settings
W/ActivityManager(  184):   Force finishing activity com.android.launcher/com.android.launcher2.Launcher
D/dalvikvm(  683): GC_FOR_ALLOC freed 317K, 38% free 10812K/17223K, paused 35ms
I/dalvikvm-heap(  683): Grow heap (frag case) to 11.666MB for 1088228-byte allocation
D/dalvikvm(  683): GC_CONCURRENT freed 0K, 32% free 11875K/17223K, paused 3ms+3ms
D/dalvikvm(  683): GC_FOR_ALLOC freed 1185K, 36% free 11167K/17223K, paused 29ms
I/dalvikvm-heap(  683): Grow heap (frag case) to 12.530MB for 1632338-byte allocation
D/dalvikvm(  683): GC_CONCURRENT freed 1062K, 33% free 11698K/17223K, paused 2ms+2ms
D/dalvikvm(  683): GC_FOR_ALLOC freed 179K, 33% free 11698K/17223K, paused 23ms
I/dalvikvm-heap(  683): Grow heap (frag case) to 12.666MB for 1229980-byte allocation
D/dalvikvm(  683): GC_CONCURRENT freed 0K, 26% free 12899K/17223K, paused 2ms+2ms
W/ActivityManager(  184): Activity pause timeout for ActivityRecord{416eb7f8 com.android.settings/.Settings}
V/MainTimelineActivity(  471): onStart: 416dc890
D/MainTimelineActivity(  471): Already in guest mode state: false
V/MainTimelineActivity(  471): onResume: 416dc890
D/InputDetector(  471): Binding voice service
D/SafeBroadcastReceiver(  471): Registered receiver 'MainTimelineActivity/longPressInterceptor'.
D/BaseHorizontalScrollView(  471): Activating.
D/ActiveItemAdapter(  471): Activating adapter.
D/OngoingActivityService(  471): Added listener ActiveItemAdapter, count=1
D/SafeBroadcastReceiver(  471): Registered receiver 'SettingsCoverView/stateReceiver'.
W/SafeBroadcastReceiver(  471): Not registering receiver 'InetConnectionState/connectivityReceiver', because it is alrea
dy registered.
D/SafeBroadcastReceiver(  471): Registered receiver 'BluetoothTetheringState/stateChangeReceiver'.
V/BatteryHelper(  471): Current battery percent: 94.0
I/BatteryHelper(  471): Driver is not reporting charged, checking percent.
V/BatteryHelper(  471): Current battery percent: 94.0
V/BatteryHelper(  471): Battery is charged? false
V/BatteryHelper(  471): Battery currently charging? true
V/BatteryHelper(  471): Battery currently charging? true
I/BatteryHelper(  471): Driver is not reporting charged, checking percent.
V/BatteryHelper(  471): Current battery percent: 94.0
V/BatteryHelper(  471): Battery is charged? false
W/InputDetector(  471): Trying to change VoiceConfig before connection to VoiceService established
D/MainTimelineView(  471): Updating cursor select args: [1371680604322]
D/MainTimelineView(  471): Updating cursor select args: [1369088614323]
D/MainTimelineActivity(  471): There is no pending task, checking for pending runnable.
D/MainTimelineActivity(  471): No pending intent, showing the timeline.
W/MainTimelineActivity(  471): No wake up time known.
D/MainTimelineActivity(  471): Setting isFromScreenOffNotification: false
D/InputDetector(  471): Voice service connected
V/BatteryHelper(  471): Current battery percent: 94.0
I/BatteryHelper(  471): Driver is not reporting charged, checking percent.
V/BatteryHelper(  471): Current battery percent: 94.0
V/BatteryHelper(  471): Battery is charged? false
V/BatteryHelper(  471): Battery currently charging? true
V/BatteryHelper(  471): Battery currently charging? true
I/BatteryHelper(  471): Driver is not reporting charged, checking percent.
V/BatteryHelper(  471): Current battery percent: 94.0
V/BatteryHelper(  471): Battery is charged? false
D/UserEventHelper(  471): Logging user event [action=UI_THREAD_QUEUE, data=|a=11.000|v=98.000|].
D/UserEventHelper(  471): Logging user event [action=UI_TIME_TO_RENDER, data=|a=0.707|v=0.962|].
D/UserEventHelper(  471): Logging user event [action=UI_TIME_BETWEEN_RENDERS, data=|a=20.974|v=164.447|].
D/MainTimelineActivity(  471): Voice Service Connected
D/MainTimelineActivity(  471): getting config from timelineView
D/VoiceService(  471): setConfig called with VoiceConfig:OFF
D/TimelineCursorManager(  471): Received updated cursor: 160
D/MainTimelineView(  471): New timeline database content loaded; updating views.
D/TimelineCursorManager(  471): Received updated cursor: 160
D/MainTimelineView(  471): New timeline database content loaded; updating views.
V/BatteryHelper(  471): Current battery percent: 94.0
I/BatteryHelper(  471): Driver is not reporting charged, checking percent.
V/BatteryHelper(  471): Current battery percent: 94.0
V/BatteryHelper(  471): Battery is charged? false
V/BatteryHelper(  471): Battery currently charging? true
V/BatteryHelper(  471): Battery currently charging? true
I/BatteryHelper(  471): Driver is not reporting charged, checking percent.
V/BatteryHelper(  471): Current battery percent: 94.0
V/BatteryHelper(  471): Battery is charged? false
D/dalvikvm(  471): GC_CONCURRENT freed 2947K, 21% free 27249K/34183K, paused 4ms+23ms
V/BatteryHelper(  683): Battery currently charging? true
I/BatteryHelper(  683): Driver is not reporting charged, checking percent.
V/BatteryHelper(  683): Current battery percent: 94.0
V/BatteryHelper(  683): Battery is charged? false
V/BatteryHelper(  683): Battery currently charging? true
I/BatteryHelper(  683): Driver is not reporting charged, checking percent.
V/BatteryHelper(  683): Current battery percent: 94.0
V/BatteryHelper(  683): Battery is charged? false
V/BatteryHelper(  683): Battery currently charging? true
I/BatteryHelper(  683): Driver is not reporting charged, checking percent.
V/BatteryHelper(  683): Current battery percent: 94.0
V/BatteryHelper(  683): Battery is charged? false
I/PowerManagerService(  184): Auto-brightness: light sensor = 239, brightness = 255

关于应该在清单中修改什么以使其正常工作的任何想法?

4

2 回答 2

3

对于来自 ICS MR1 分支的 Settings apk,除了删除 AndroidManifest 中的 sharedUserId 字段...

您看到的崩溃是因为持有人的图标和摘要字段为空。com.android.internal.R.layout.preference_header_item 是一个简单的 TextView。

如果您交换 R.layout.preference_header_switch_item,并隐藏它应该可以工作的开关。

@@ -480,9 +481,10 @@ public class Settings extends PreferenceActivity implements ButtonBarHandler {

                     case HEADER_TYPE_NORMAL:
                         view = mInflater.inflate(
-                                com.android.internal.R.layout.preference_header_item, parent,
+                                R.layout.preference_header_switch_item, parent,
                                 false);
-                        holder.icon = (ImageView) view.findViewById(com.android.internal.R.id.icon);
+                        view.findViewById(R.id.switchWidget).setVisibility(View.GONE);
+                        holder.icon = (ImageView) view.findViewById(R.id.icon);
                         holder.title = (TextView)
                                 view.findViewById(com.android.internal.R.id.title);
                         holder.summary = (TextView)
于 2013-05-23T06:48:34.807 回答
1

android:sharedUserId="android.uid.system" 如果您从 ICS MR1 分支编译设置 apk,则应删除此行。

于 2013-05-22T02:41:09.137 回答