在Android 4.0.4中执行菜单inflater时应用程序强制关闭

时间:2012-09-10 06:46:52

标签: android menuitem

我在android api版本8上构建了一个应用程序,我选择这个选项,因为我认为它可以在较新版本的Android中运行,但是当我尝试按照我在标题中提到的那样做时,我的应用程序强制关闭。应用程序启动并正常工作,只有菜单inflater中的错误,这是我的代码:

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // TODO Auto-generated method stub
    Toast.makeText(this, "About Developer", Toast.LENGTH_LONG).show();
    Intent i = new Intent(this, about.class);
    startActivity(i);
    return true;
}

有没有人有任何想法解决它?

Logcat:

    09-10 14:07:02.630: DEBUG/AndroidRuntime(1631): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
09-10 14:07:02.646: DEBUG/AndroidRuntime(1631): CheckJNI is ON
09-10 14:07:10.746: DEBUG/AndroidRuntime(1631): Calling main entry com.android.commands.pm.Pm
09-10 14:07:12.027: DEBUG/dalvikvm(266): GC_EXPLICIT freed 10K, 54% free 2552K/5511K, external 716K/1038K, paused 360ms
09-10 14:07:12.086: WARN/ActivityManager(68): No content provider found for: 
09-10 14:07:12.237: WARN/ActivityManager(68): No content provider found for: 
09-10 14:07:12.307: DEBUG/PackageParser(68): Scanning package: /data/app/vmdl-674477132.tmp
09-10 14:07:12.707: INFO/PackageManager(68): Removing non-system package:com.dg.tkd
09-10 14:07:12.707: INFO/ActivityManager(68): Force stopping package com.dg.tkd uid=10036
09-10 14:07:12.837: INFO/Process(68): Sending signal. PID: 1618 SIG: 9
09-10 14:07:12.928: ERROR/InputDispatcher(68): channel '4079e2f8 com.dg.tkd/com.dg.tkd.digital_tkd (server)' ~ Consumer closed input channel or an error occurred.  events=0x8
09-10 14:07:12.928: ERROR/InputDispatcher(68): channel '4079e2f8 com.dg.tkd/com.dg.tkd.digital_tkd (server)' ~ Channel is unrecoverably broken and will be disposed!
09-10 14:07:12.947: INFO/ActivityManager(68):   Force finishing activity HistoryRecord{406a3e48 com.dg.tkd/.digital_tkd}
09-10 14:07:12.986: INFO/WindowManager(68): WIN DEATH: Window{407ea958 com.dg.tkd/com.dg.tkd.about paused=false}
09-10 14:07:13.037: INFO/WindowManager(68): WIN DEATH: Window{4079e2f8 com.dg.tkd/com.dg.tkd.digital_tkd paused=false}
09-10 14:07:13.086: ERROR/InputDispatcher(68): Received spurious receive callback for unknown input channel.  fd=161, events=0x8
09-10 14:07:13.447: DEBUG/dalvikvm(68): GC_CONCURRENT freed 1043K, 46% free 4596K/8455K, external 3251K/3627K, paused 24ms+31ms
09-10 14:07:13.788: DEBUG/PackageManager(68): Scanning package com.dg.tkd
09-10 14:07:13.788: INFO/ActivityManager(68): Start proc com.android.launcher for activity com.android.launcher/com.android.launcher2.Launcher: pid=1641 uid=10001 gids={}
09-10 14:07:13.836: INFO/PackageManager(68): Package com.dg.tkd codePath changed from /data/app/com.dg.tkd-1.apk to /data/app/com.dg.tkd-2.apk; Retaining data and using new
09-10 14:07:14.146: INFO/PackageManager(68): Unpacking native libraries for /data/app/com.dg.tkd-2.apk
09-10 14:07:14.707: DEBUG/installd(35): DexInv: --- BEGIN '/data/app/com.dg.tkd-2.apk' ---
09-10 14:07:15.457: DEBUG/dalvikvm(1649): DexOpt: load 72ms, verify+opt 125ms
09-10 14:07:15.537: DEBUG/installd(35): DexInv: --- END '/data/app/com.dg.tkd-2.apk' (success) ---
09-10 14:07:15.546: WARN/PackageManager(68): Code path for pkg : com.dg.tkd changing from /data/app/com.dg.tkd-1.apk to /data/app/com.dg.tkd-2.apk
09-10 14:07:15.546: WARN/PackageManager(68): Resource path for pkg : com.dg.tkd changing from /data/app/com.dg.tkd-1.apk to /data/app/com.dg.tkd-2.apk
09-10 14:07:15.546: DEBUG/PackageManager(68):   Activities: com.dg.tkd.digital_tkd com.dg.tkd.about
09-10 14:07:15.747: INFO/installd(35): move /data/dalvik-cache/data@app@com.dg.tkd-2.apk@classes.dex -> /data/dalvik-cache/data@app@com.dg.tkd-2.apk@classes.dex
09-10 14:07:15.757: DEBUG/PackageManager(68): New package installed in /data/app/com.dg.tkd-2.apk
09-10 14:07:16.047: INFO/WindowManager(68): Setting rotation to 0, animFlags=1
09-10 14:07:16.146: INFO/ActivityManager(68): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/2 nav=3/1 orien=1 layout=18 uiMode=17 seq=48}
09-10 14:07:16.717: INFO/ActivityManager(68): Force stopping package com.dg.tkd uid=10036
09-10 14:07:17.717: INFO/ActivityThread(1641): Pub com.android.launcher2.settings: com.android.launcher2.LauncherProvider
09-10 14:07:19.727: DEBUG/dalvikvm(1641): GC_EXTERNAL_ALLOC freed 457K, 54% free 2684K/5767K, external 1032K/1038K, paused 107ms
09-10 14:07:20.607: INFO/ActivityManager(68): Displayed com.android.launcher/com.android.launcher2.Launcher: +7s521ms
09-10 14:07:20.687: WARN/InputManagerService(68): Got RemoteException sending setActive(false) notification to pid 1618 uid 10036
09-10 14:07:21.156: WARN/WindowManager(68): App freeze timeout expired.
09-10 14:07:21.657: INFO/ActivityManager(68): Force stopping package com.dg.tkd uid=10036
09-10 14:07:22.097: DEBUG/dalvikvm(1641): GC_EXTERNAL_ALLOC freed 97K, 53% free 2718K/5767K, external 1561K/1572K, paused 229ms
09-10 14:07:22.256: DEBUG/dalvikvm(68): GC_EXPLICIT freed 514K, 47% free 4504K/8455K, external 3247K/3627K, paused 397ms
09-10 14:07:23.517: DEBUG/dalvikvm(68): GC_EXPLICIT freed 18K, 47% free 4486K/8455K, external 3247K/3627K, paused 240ms
09-10 14:07:25.356: WARN/RecognitionManagerService(68): no available voice recognition services found
09-10 14:07:26.056: DEBUG/dalvikvm(68): GC_EXPLICIT freed 129K, 47% free 4515K/8455K, external 3247K/3627K, paused 391ms
09-10 14:07:26.906: INFO/installd(35): unlink /data/dalvik-cache/data@app@com.dg.tkd-1.apk@classes.dex
09-10 14:07:27.037: DEBUG/AndroidRuntime(1631): Shutting down VM
09-10 14:07:27.097: INFO/AndroidRuntime(1631): NOTE: attach of thread 'Binder Thread #4' failed
09-10 14:07:27.117: DEBUG/dalvikvm(1631): GC_CONCURRENT freed 100K, 72% free 293K/1024K, external 0K/0K, paused 16ms+18ms
09-10 14:07:27.157: DEBUG/dalvikvm(1631): Debugger has detached; object registry had 1 entries
09-10 14:07:29.029: DEBUG/AndroidRuntime(1657): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
09-10 14:07:29.029: DEBUG/AndroidRuntime(1657): CheckJNI is ON
09-10 14:07:30.966: DEBUG/dalvikvm(1641): GC_CONCURRENT freed 224K, 50% free 2915K/5767K, external 1959K/2091K, paused 9ms+9ms
09-10 14:07:31.826: DEBUG/AndroidRuntime(1657): Calling main entry com.android.commands.am.Am
09-10 14:07:32.726: INFO/ActivityManager(68): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.dg.tkd/.digital_tkd } from pid 1657
09-10 14:07:32.857: DEBUG/AndroidRuntime(1657): Shutting down VM
09-10 14:07:32.926: INFO/AndroidRuntime(1657): NOTE: attach of thread 'Binder Thread #3' failed
09-10 14:07:33.037: DEBUG/dalvikvm(1657): GC_CONCURRENT freed 102K, 69% free 319K/1024K, external 0K/0K, paused 4ms+2ms
09-10 14:07:33.108: DEBUG/jdwp(1657): Got wake-up signal, bailing out of select
09-10 14:07:33.108: DEBUG/dalvikvm(1657): Debugger has detached; object registry had 1 entries
09-10 14:07:33.327: WARN/ActivityManager(68): Activity pause timeout for HistoryRecord{40796458 com.android.launcher/com.android.launcher2.Launcher}
09-10 14:07:33.446: INFO/ActivityManager(68): Start proc com.dg.tkd for activity com.dg.tkd/.digital_tkd: pid=1666 uid=10036 gids={}
09-10 14:07:34.347: INFO/WindowManager(68): Setting rotation to 1, animFlags=1
09-10 14:07:34.386: INFO/ActivityManager(68): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/2 nav=3/1 orien=2 layout=18 uiMode=17 seq=49}
09-10 14:07:35.997: INFO/ActivityManager(68): Displayed com.dg.tkd/.digital_tkd: +2s584ms
09-10 14:07:37.786: DEBUG/dalvikvm(266): GC_EXPLICIT freed 8K, 54% free 2551K/5511K, external 716K/1038K, paused 381ms
09-10 14:07:38.046: WARN/IInputConnectionWrapper(1641): showStatusIcon on inactive InputConnection
09-10 14:07:38.337: DEBUG/dalvikvm(1641): GC_EXTERNAL_ALLOC freed 33K, 50% free 2899K/5767K, external 1953K/2091K, paused 88ms
09-10 14:07:38.896: DEBUG/dalvikvm(68): GC_EXPLICIT freed 298K, 47% free 4490K/8455K, external 3247K/3627K, paused 172ms
09-10 14:07:40.007: DEBUG/dalvikvm(1641): GC_EXTERNAL_ALLOC freed 48K, 50% free 2891K/5767K, external 2754K/2940K, paused 104ms
09-10 14:07:41.847: DEBUG/dalvikvm(317): GC_EXPLICIT freed 12K, 55% free 2578K/5703K, external 716K/1038K, paused 167ms
09-10 14:07:45.489: INFO/ActivityManager(68): Process android.process.media (pid 210) has died.
09-10 14:07:47.356: DEBUG/dalvikvm(341): GC_EXPLICIT freed 5K, 55% free 2520K/5511K, external 716K/1038K, paused 644ms
09-10 14:07:49.816: DEBUG/dalvikvm(1641): GC_EXTERNAL_ALLOC freed 9K, 51% free 2882K/5767K, external 5999K/7492K, paused 167ms
09-10 14:08:18.196: WARN/KeyCharacterMap(1666): No keyboard for id 0
09-10 14:08:18.196: WARN/KeyCharacterMap(1666): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
09-10 14:08:21.546: INFO/ActivityManager(68): Starting: Intent { cmp=com.dg.tkd/.about } from pid 1666
09-10 14:08:22.097: DEBUG/dalvikvm(1666): GC_EXTERNAL_ALLOC freed 65K, 52% free 2608K/5379K, external 908K/1038K, paused 97ms
09-10 14:08:23.776: INFO/ActivityManager(68): Displayed com.dg.tkd/.about: +2s112ms

0 个答案:

没有答案