【问题标题】:Android app is closed after pressing homeAndroid 应用程序在按 home 后关闭
【发布时间】:2014-06-25 12:10:42
【问题描述】:

当我按下 home buttonbutton to see what applications are running 时 - 我的应用程序关闭。我试图添加onPause()onResume() 等,但什么也没有。它发生在重构后的一段时间内。

原木猫:

05-08 05:13:05.613: D/dalvikvm(655): GC_FOR_ALLOC freed 806K, 75% free 5048K/19820K, paused 59ms, total 61ms
05-08 05:13:05.683: E/SoundPool(375): error loading /system/media/audio/ui/Effect_Tick.ogg
05-08 05:13:05.683: W/AudioService(375): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
05-08 05:13:05.683: E/SoundPool(375): error loading /system/media/audio/ui/Effect_Tick.ogg
05-08 05:13:05.683: W/AudioService(375): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
05-08 05:13:05.683: E/SoundPool(375): error loading /system/media/audio/ui/Effect_Tick.ogg
05-08 05:13:05.683: W/AudioService(375): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
05-08 05:13:05.683: E/SoundPool(375): error loading /system/media/audio/ui/Effect_Tick.ogg
05-08 05:13:05.683: W/AudioService(375): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
05-08 05:13:05.683: E/SoundPool(375): error loading /system/media/audio/ui/Effect_Tick.ogg
05-08 05:13:05.683: W/AudioService(375): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
05-08 05:13:05.683: E/SoundPool(375): error loading /system/media/audio/ui/KeypressStandard.ogg
05-08 05:13:05.683: W/AudioService(375): Soundpool could not load file: /system/media/audio/ui/KeypressStandard.ogg
05-08 05:13:05.683: E/SoundPool(375): error loading /system/media/audio/ui/KeypressSpacebar.ogg
05-08 05:13:05.683: W/AudioService(375): Soundpool could not load file: /system/media/audio/ui/KeypressSpacebar.ogg
05-08 05:13:05.683: E/SoundPool(375): error loading /system/media/audio/ui/KeypressDelete.ogg
05-08 05:13:05.693: W/AudioService(375): Soundpool could not load file: /system/media/audio/ui/KeypressDelete.ogg
05-08 05:13:05.693: E/SoundPool(375): error loading /system/media/audio/ui/KeypressReturn.ogg
05-08 05:13:05.693: W/AudioService(375): Soundpool could not load file: /system/media/audio/ui/KeypressReturn.ogg
05-08 05:13:05.693: E/SoundPool(375): error loading /system/media/audio/ui/KeypressInvalid.ogg
05-08 05:13:05.703: W/AudioService(375): Soundpool could not load file: /system/media/audio/ui/KeypressInvalid.ogg
05-08 05:13:05.703: W/AudioService(375): onLoadSoundEffects(), Error -1 while loading samples
05-08 05:13:05.713: I/ActivityManager(375): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.android.launcher/com.android.launcher2.Launcher} from pid 375
05-08 05:13:05.733: D/gralloc(49): Registering a buffer in the process that created it. This may cause memory ordering problems.
05-08 05:13:05.733: E/libEGL(49): called unimplemented OpenGL ES API
05-08 05:13:05.743: E/libEGL(49): called unimplemented OpenGL ES API
05-08 05:13:05.743: E/libEGL(49): called unimplemented OpenGL ES API
05-08 05:13:05.743: E/libEGL(49): called unimplemented OpenGL ES API
05-08 05:13:05.743: E/SurfaceFlinger(49): glCheckFramebufferStatusOES error -2009986491
05-08 05:13:05.743: E/SurfaceFlinger(49): got GL_FRAMEBUFFER_COMPLETE_OES error while taking screenshot
05-08 05:13:05.743: E/libEGL(49): called unimplemented OpenGL ES API
05-08 05:13:05.743: E/libEGL(49): called unimplemented OpenGL ES API
05-08 05:13:05.743: W/WindowManager(375): Screenshot failure taking screenshot for (266x425) to layer 21015
05-08 05:13:07.213: I/Choreographer(544): Skipped 88 frames!  The application may be doing too much work on its main thread.

【问题讨论】:

  • 请发布您的代码和错误日志!
  • 长按还是长按?两者都执行不同的操作。
  • 您是否在 onPause() 中添加了一个 Log 以检查您的应用程序是否未执行 onPause() ?添加你的 onPause () Log.i("onPause","onPause starts !");
  • 请张贴你的日志猫
  • 简单按下后。时间不长。

标签: android button destroy


【解决方案1】:

我发现了问题。问题是未在 AndroiManifest.xml 中指定启动器活动的标签

<activity
            android:name="com.test.MainActivity"
            android:label="@string/title_activity_main" >
            <intent-filter android:label="@string/app_name" >
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多