I've got problem with camera app installed on emulator. Every time I want to launch camera I got such nasty thing. USing Intellij Idea (newest version) I'm creating new hardware with both cameras included, byt non of these works. I'm aware of errors printed below, but I don't have idea how to fix it (it hurts me especially while developing apps using capturing photos).
What I should do to make use for fake-camera and capture fake image produced in emulator for camera functionality?
11-25 13:31:12.527: E/CameraService(927): CameraService::connect X (pid 2426) rejected (invalid cameraId 0).
11-25 13:31:12.527: W/CameraBase(2426): An error occurred while connecting to camera: 0
11-25 13:31:12.527: E/CameraHolder(2426): fail to connect Camera
11-25 13:31:12.527: E/CameraHolder(2426): java.lang.RuntimeException: Fail to connect to camera service
11-25 13:31:12.527: E/CameraHolder(2426): at android.hardware.Camera.native_setup(Native Method)
11-25 13:31:12.527: E/CameraHolder(2426): at android.hardware.Camera.<init>(Camera.java:350)
11-25 13:31:12.527: E/CameraHolder(2426): at android.hardware.Camera.open(Camera.java:309)
11-25 13:31:12.527: E/CameraHolder(2426): at com.android.camera.CameraHolder.open(CameraHolder.java:131)
11-25 13:31:12.527: E/CameraHolder(2426): at com.android.camera.Util.openCamera(Util.java:267)
11-25 13:31:12.527: E/CameraHolder(2426): at com.android.camera.Camera$4.run(Camera.java:1100)
11-25 13:31:12.527: E/CameraHolder(2426): at java.lang.Thread.run(Thread.java:841)
11-25 13:31:12.527: W/dalvikvm(2426): threadid=11: thread exiting with uncaught exception (group=0xb1d37b20)
11-25 13:31:12.527: E/AndroidRuntime(2426): FATAL EXCEPTION: Thread-93
11-25 13:31:12.527: E/AndroidRuntime(2426): Process: com.android.camera, PID: 2426
11-25 13:31:12.527: E/AndroidRuntime(2426): java.lang.RuntimeException: openCamera failed
11-25 13:31:12.527: E/AndroidRuntime(2426): at com.android.camera.Util.openCamera(Util.java:272)
11-25 13:31:12.527: E/AndroidRuntime(2426): at com.android.camera.Camera$4.run(Camera.java:1100)
11-25 13:31:12.527: E/AndroidRuntime(2426): at java.lang.Thread.run(Thread.java:841)
11-25 13:31:12.527: E/AndroidRuntime(2426): Caused by: com.android.camera.CameraHardwareException: java.lang.RuntimeException: Fail to connect to camera service
11-25 13:31:12.527: E/AndroidRuntime(2426): at com.android.camera.CameraHolder.open(CameraHolder.java:135)
11-25 13:31:12.527: E/AndroidRuntime(2426): at com.android.camera.Util.openCamera(Util.java:267)
11-25 13:31:12.527: E/AndroidRuntime(2426): ... 2 more
11-25 13:31:12.527: E/AndroidRuntime(2426): Caused by: java.lang.RuntimeException: Fail to connect to camera service
11-25 13:31:12.527: E/AndroidRuntime(2426): at android.hardware.Camera.native_setup(Native Method)
11-25 13:31:12.527: E/AndroidRuntime(2426): at android.hardware.Camera.<init>(Camera.java:350)
11-25 13:31:12.527: E/AndroidRuntime(2426): at android.hardware.Camera.open(Camera.java:309)
11-25 13:31:12.527: E/AndroidRuntime(2426): at com.android.camera.CameraHolder.open(CameraHolder.java:131)
11-25 13:31:12.527: E/AndroidRuntime(2426): ... 3 more
11-25 13:31:12.557: W/ActivityManager(1261): Force finishing activity com.android.camera/.Camera
11-25 13:31:12.567: D/dalvikvm(2426): GC_FOR_ALLOC freed 212K, 8% free 3387K/3680K, paused 6ms, total 7ms
11-25 13:31:12.567: E/gralloc_goldfish(924): gralloc_alloc: Mismatched usage flags: 492 x 874, usage 333
11-25 13:31:12.567: W/GraphicBufferAllocator(924): alloc(492, 874, 1, 00000333, ...) failed -22 (Invalid argument)
11-25 13:31:12.567: E/(924): GraphicBufferAlloc::createGraphicBuffer(w=492, h=874) failed (Invalid argument), handle=0x0
11-25 13:31:12.567: E/BufferQueue(1261): [ScreenshotClient] dequeueBuffer: SurfaceComposer::createGraphicBuffer failed
11-25 13:31:12.567: W/WindowManager(1261): Screenshot failure taking screenshot for (492x874) to layer 21010
11-25 13:31:12.607: D/dalvikvm(2426): GC_FOR_ALLOC freed 18K, 7% free 3570K/3836K, paused 2ms, total 2ms
11-25 13:31:12.607: I/dalvikvm-heap(2426): Grow heap (frag case) to 4.978MB for 1490412-byte allocation
11-25 13:31:12.637: D/dalvikvm(2426): GC_FOR_ALLOC freed 2K, 6% free 5023K/5292K, paused 17ms, total 17ms
11-25 13:31:12.667: D/dalvikvm(2426): GC_FOR_ALLOC freed 14K, 5% free 5444K/5692K, paused 3ms, total 3ms
11-25 13:31:12.677: D/dalvikvm(2426): GC_FOR_ALLOC freed 9K, 5% free 5768K/6012K, paused 4ms, total 5ms
11-25 13:31:12.687: D/dalvikvm(2426): GC_FOR_ALLOC freed 3K, 4% free 6446K/6688K, paused 4ms, total 4ms
11-25 13:31:13.087: W/ActivityManager(1261): Activity pause timeout for ActivityRecord{b27fac48 u0 com.android.camera/.Camera t7 f}
11-25 13:31:13.127: W/EGL_emulation(1415): eglSurfaceAttrib not implemented
11-25 13:31:22.217: E/WindowManager(1261): Starting window AppWindowToken{b27ff320 token=Token{b27fada8 ActivityRecord{b27fac48 u0 com.android.camera/.Camera t7}}} timed out
11-25 13:31:23.197: W/ActivityManager(1261): Activity destroy timeout for ActivityRecord{b27fac48 u0 com.android.camera/.Camera t7 f}
11-25 13:31:41.508: I/Process(2426): Sending signal. PID: 2426 SIG: 9
11-25 13:31:41.508: I/ActivityManager(1261): Process com.android.camera (pid 2426) has died.
11-25 13:31:41.528: E/SoundPool(1261): error loading /system/media/audio/ui/Effect_Tick.ogg
11-25 13:31:41.528: W/AudioService(1261): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
11-25 13:31:41.528: E/SoundPool(1261): error loading /system/media/audio/ui/Effect_Tick.ogg
11-25 13:31:41.528: W/AudioService(1261): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
11-25 13:31:41.528: E/SoundPool(1261): error loading /system/media/audio/ui/Effect_Tick.ogg
11-25 13:31:41.528: W/AudioService(1261): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
11-25 13:31:41.528: E/SoundPool(1261): error loading /system/media/audio/ui/Effect_Tick.ogg
11-25 13:31:41.528: W/AudioService(1261): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
11-25 13:31:41.528: E/SoundPool(1261): error loading /system/media/audio/ui/Effect_Tick.ogg
11-25 13:31:41.528: W/AudioService(1261): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
11-25 13:31:41.528: E/SoundPool(1261): error loading /system/media/audio/ui/KeypressStandard.ogg
11-25 13:31:41.528: W/AudioService(1261): Soundpool could not load file: /system/media/audio/ui/KeypressStandard.ogg
11-25 13:31:41.528: E/SoundPool(1261): error loading /system/media/audio/ui/KeypressSpacebar.ogg
11-25 13:31:41.528: W/AudioService(1261): Soundpool could not load file: /system/media/audio/ui/KeypressSpacebar.ogg
11-25 13:31:41.528: E/SoundPool(1261): error loading /system/media/audio/ui/KeypressDelete.ogg
11-25 13:31:41.528: W/AudioService(1261): Soundpool could not load file: /system/media/audio/ui/KeypressDelete.ogg
11-25 13:31:41.528: E/SoundPool(1261): error loading /system/media/audio/ui/KeypressReturn.ogg
11-25 13:31:41.528: W/AudioService(1261): Soundpool could not load file: /system/media/audio/ui/KeypressReturn.ogg
11-25 13:31:41.528: E/SoundPool(1261): error loading /system/media/audio/ui/KeypressInvalid.ogg
11-25 13:31:41.528: W/AudioService(1261): Soundpool could not load file: /system/media/audio/ui/KeypressInvalid.ogg
11-25 13:31:41.528: W/AudioService(1261): onLoadSoundEffects(), Error -1 while loading samples
11-25 13:31:41.528: W/InputMethodManagerService(1261): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#b2882de8 attribute=null, token = android.os.BinderProxy#b23d9688
11-25 13:34:01.090: D/dalvikvm(1261): GC_FOR_ALLOC freed 1204K, 11% free 10400K/11684K, paused 15ms, total 16ms
11-25 13:38:44.164: D/dalvikvm(1400): GC_FOR_ALLOC freed 541K, 15% free 3672K/4284K, paused 10ms, total 21ms
Related
I want to run my android app from ADB So I run this command
adb -s emulator-5554 shell am start -W -S -n com.example.myproj/.MainActivity
My application starts in emulator but it force closed and the message unfortunately stopped working showed on emulator screen. I try both genymotion and eclipse emulator and got same error.But when I run it from eclipse directly it does not any force close problem.
I should mention that I use ubuntu 14.04 32bit.
Please help me and say what is my mistake and how I can fix it?
ok I use logcat as result I have very long log I just put last part which I can see from command line and seems to relevant to my app
D/gralloc ( 51): Registering a buffer in the process that created it.
This may cause memory ordering problems.
E/libEGL ( 51): called unimplemented OpenGL ES API
E/libEGL ( 51): called unimplemented OpenGL ES API
E/libEGL ( 51): called unimplemented OpenGL ES API
E/libEGL ( 51): called unimplemented OpenGL ES API
E/SurfaceFlinger( 51): glCheckFramebufferStatusOES error 1304732677
E/SurfaceFlinger( 51): got GL_FRAMEBUFFER_COMPLETE_OES error while taking screenshot
E/libEGL ( 51): called unimplemented OpenGL ES API
E/libEGL ( 51): called unimplemented OpenGL ES API
W/WindowManager( 361): Screenshot failure taking screenshot for (266x425) to layer 21005
D/AndroidRuntime( 1133): Shutting down VM
I/ActivityManager( 361): Start proc com.example.myproj for activity com.example.myproj/.MainActivity: pid=1144 uid=10051 gids={50051, 1028, 1015}
D/dalvikvm( 1133): GC_CONCURRENT freed 96K, 15% free 585K/684K, paused 22ms+12ms, total 59ms
D/dalvikvm( 1144): Not late-enabling CheckJNI (already on)
I/Choreographer( 531): Skipped 32 frames! The application may be doing too much work on its main thread.
I/Choreographer( 361): Skipped 33 frames! The application may be doing too much work on its main thread.
W/dalvikvm( 1144): VFY: register1 v4 holds uninitialized ref
W/dalvikvm( 1144): VFY: bad arg 0 (into Ljava/lang/Object;)
W/dalvikvm( 1144): VFY: rejecting call to Lacteve/symbolic/Util;.write (Ljava/lang/Object;I)V
W/dalvikvm( 1144): VFY: rejecting opcode 0x71 at 0x000a
W/dalvikvm( 1144): VFY: rejected Lcom/example/myproj/MainActivity$1;.<init> (Lcom/example/myproj/MainActivity;)V
W/dalvikvm( 1144): Verifier rejected class Lcom/example/myproj/MainActivity$1;
D/AndroidRuntime( 1144): Shutting down VM
W/dalvikvm( 1144): threadid=1: thread exiting with uncaught exception (group=0xb3ae0b90)
E/AndroidRuntime( 1144): FATAL EXCEPTION: main
E/AndroidRuntime( 1144): Process: com.example.myproj, PID: 1144
E/AndroidRuntime( 1144): java.lang.VerifyError: com/example/myproj/MainActivity$1
E/AndroidRuntime( 1144): at com.example.myproj.MainActivity.dol(MainActivity.java:24)
E/AndroidRuntime( 1144): at com.example.myproj.MainActivity.onCreate(MainActivity.java:17)
E/AndroidRuntime( 1144): at android.app.Activity.performCreate(Activity.java:5243)
E/AndroidRuntime( 1144): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
E/AndroidRuntime( 1144): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2140)
E/AndroidRuntime( 1144): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
E/AndroidRuntime( 1144): at android.app.ActivityThread.access$700(ActivityThread.java:135)
E/AndroidRuntime( 1144): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
E/AndroidRuntime( 1144): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 1144): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 1144): at android.app.ActivityThread.main(ActivityThread.java:4998)
E/AndroidRuntime( 1144): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1144): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 1144): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
E/AndroidRuntime( 1144): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
E/AndroidRuntime( 1144): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 361): Force finishing activity com.example.myproj/.MainActivity
I/WindowManager( 361): Screenshot max retries 4 of Token{b40b44d0 ActivityRecord{b40181a0 u0 com.example.myproj/.MainActivity t7 f}} appWin=Window{b41a0fe8 u0 Starting com.example.myproj} drawState=4
W/WindowManager( 361): Screenshot failure taking screenshot for (800x1280) to layer 21010
W/ActivityManager( 361): Activity pause timeout for ActivityRecord{b40181a0 u0 com.example.myproj/.MainActivity t7 f}
I/Process ( 1144): Sending signal. PID: 1144 SIG: 9
I/ActivityManager( 361): Process com.example.myproj (pid 1144) has died.
E/SoundPool( 361): error loading /system/media/audio/ui/Effect_Tick.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
E/SoundPool( 361): error loading /system/media/audio/ui/Effect_Tick.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
E/SoundPool( 361): error loading /system/media/audio/ui/Effect_Tick.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
E/SoundPool( 361): error loading /system/media/audio/ui/Effect_Tick.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
E/SoundPool( 361): error loading /system/media/audio/ui/Effect_Tick.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
E/SoundPool( 361): error loading /system/media/audio/ui/KeypressStandard.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/KeypressStandard.ogg
E/SoundPool( 361): error loading /system/media/audio/ui/KeypressSpacebar.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/KeypressSpacebar.ogg
E/SoundPool( 361): error loading /system/media/audio/ui/KeypressDelete.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/KeypressDelete.ogg
E/SoundPool( 361): error loading /system/media/audio/ui/KeypressReturn.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/KeypressReturn.ogg
E/SoundPool( 361): error loading /system/media/audio/ui/KeypressInvalid.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/KeypressInvalid.ogg
W/AudioService( 361): onLoadSoundEffects(), Error -1 while loading samples
I/Choreographer( 361): Skipped 40 frames! The application may be doing too much work on its main thread.
W/InputMethodManagerService( 361): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#b417b3a0 attribute=null, token = android.os.BinderProxy#b404fb70
D/AndroidRuntime( 1161):
D/AndroidRuntime( 1161): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime( 1161): CheckJNI is ON
D/dalvikvm( 1161): Trying to load lib libjavacore.so 0x0
D/dalvikvm( 1161): Added shared lib libjavacore.so 0x0
D/dalvikvm( 1161): Trying to load lib libnativehelper.so 0x0
D/dalvikvm( 1161): Added shared lib libnativehelper.so 0x0
D/dalvikvm( 1161): No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
D/dalvikvm( 1161): Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
E/memtrack( 1161): Couldn't load memtrack module (No such file or directory)
E/android.os.Debug( 1161): failed to load memtrack module: -2
D/AndroidRuntime( 1161): Calling main entry com.android.commands.am.Am
I/ActivityManager( 361): Force stopping com.example.myproj appid=10051 user=0: from pid 1161
I/ActivityManager( 361): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.myproj/.MainActivity} from pid 1161
D/gralloc ( 51): Registering a buffer in the process that created it. This may cause memory ordering problems.
E/libEGL ( 51): called unimplemented OpenGL ES API
E/libEGL ( 51): called unimplemented OpenGL ES API
E/libEGL ( 51): called unimplemented OpenGL ES API
E/libEGL ( 51): called unimplemented OpenGL ES API
E/SurfaceFlinger( 51): glCheckFramebufferStatusOES error 1304732677
E/SurfaceFlinger( 51): got GL_FRAMEBUFFER_COMPLETE_OES error while taking screenshot
E/libEGL ( 51): called unimplemented OpenGL ES API
E/libEGL ( 51): called unimplemented OpenGL ES API
W/WindowManager( 361): Screenshot failure taking screenshot for (266x425) to layer 21005
D/AndroidRuntime( 1161): Shutting down VM
D/dalvikvm( 1161): GC_CONCURRENT freed 96K, 15% free 589K/688K, paused 23ms+32ms, total 71ms
D/dalvikvm( 1172): Not late-enabling CheckJNI (already on)
I/ActivityManager( 361): Start proc com.example.myproj for activity com.example.myproj/.MainActivity: pid=1172 uid=10051 gids={50051, 1028, 1015}
I/Choreographer( 361): Skipped 39 frames! The application may be doing too much work on its main thread.
I/Choreographer( 361): Skipped 34 frames! The application may be doing too much work on its main thread.
W/dalvikvm( 1172): VFY: register1 v4 holds uninitialized ref
W/dalvikvm( 1172): VFY: bad arg 0 (into Ljava/lang/Object;)
W/dalvikvm( 1172): VFY: rejecting call to Lacteve/symbolic/Util;.write (Ljava/lang/Object;I)V
W/dalvikvm( 1172): VFY: rejecting opcode 0x71 at 0x000a
W/dalvikvm( 1172): VFY: rejected Lcom/example/myproj/MainActivity$1;.<init> (Lcom/example/myproj/MainActivity;)V
W/dalvikvm( 1172): Verifier rejected class Lcom/example/myproj/MainActivity$1;
D/AndroidRuntime( 1172): Shutting down VM
W/dalvikvm( 1172): threadid=1: thread exiting with uncaught exception (group=0xb3ae0b90)
E/AndroidRuntime( 1172): FATAL EXCEPTION: main
E/AndroidRuntime( 1172): Process: com.example.myproj, PID: 1172
E/AndroidRuntime( 1172): java.lang.VerifyError: com/example/myproj/MainActivity$1
E/AndroidRuntime( 1172): at com.example.myproj.MainActivity.dol(MainActivity.java:24)
E/AndroidRuntime( 1172): at com.example.myproj.MainActivity.onCreate(MainActivity.java:17)
E/AndroidRuntime( 1172): at android.app.Activity.performCreate(Activity.java:5243)
E/AndroidRuntime( 1172): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
E/AndroidRuntime( 1172): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2140)
E/AndroidRuntime( 1172): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
E/AndroidRuntime( 1172): at android.app.ActivityThread.access$700(ActivityThread.java:135)
E/AndroidRuntime( 1172): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
E/AndroidRuntime( 1172): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 1172): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 1172): at android.app.ActivityThread.main(ActivityThread.java:4998)
E/AndroidRuntime( 1172): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1172): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 1172): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
E/AndroidRuntime( 1172): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
E/AndroidRuntime( 1172): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 361): Force finishing activity com.example.myproj/.MainActivity
I/WindowManager( 361): Screenshot max retries 4 of Token{b4186bf8 ActivityRecord{b4186a98 u0 com.example.myproj/.MainActivity t8 f}} appWin=Window{b417dc10 u0 Starting com.example.myproj} drawState=4
W/WindowManager( 361): Screenshot failure taking screenshot for (800x1280) to layer 21010
W/ActivityManager( 361): Activity pause timeout for ActivityRecord{b4186a98 u0 com.example.myproj/.MainActivity t8 f}
I/Process ( 1172): Sending signal. PID: 1172 SIG: 9
E/SoundPool( 361): error loading /system/media/audio/ui/Effect_Tick.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
E/SoundPool( 361): error loading /system/media/audio/ui/Effect_Tick.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
E/SoundPool( 361): error loading /system/media/audio/ui/Effect_Tick.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
E/SoundPool( 361): error loading /system/media/audio/ui/Effect_Tick.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
E/SoundPool( 361): error loading /system/media/audio/ui/Effect_Tick.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
E/SoundPool( 361): error loading /system/media/audio/ui/KeypressStandard.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/KeypressStandard.ogg
E/SoundPool( 361): error loading /system/media/audio/ui/KeypressSpacebar.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/KeypressSpacebar.ogg
E/SoundPool( 361): error loading /system/media/audio/ui/KeypressDelete.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/KeypressDelete.ogg
I/dalvikvm( 361): Jit: resizing JitTable from 4096 to 8192
I/ActivityManager( 361): Process com.example.myproj (pid 1172) has died.
E/SoundPool( 361): error loading /system/media/audio/ui/KeypressReturn.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/KeypressReturn.ogg
E/SoundPool( 361): error loading /system/media/audio/ui/KeypressInvalid.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/KeypressInvalid.ogg
W/AudioService( 361): onLoadSoundEffects(), Error -1 while loading samples
D/LightsService( 361): Excessive delay setting light: 444ms
D/LightsService( 361): Excessive delay setting light: 102ms
W/InputMethodManagerService( 361): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#b421b110 attribute=null, token = android.os.BinderProxy#b404fb70
D/dalvikvm( 361): GC_CONCURRENT freed 660K, 10% free 6734K/7468K, paused 7ms+17ms, total 344ms
D/AndroidRuntime( 1189):
D/AndroidRuntime( 1189): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime( 1189): CheckJNI is ON
D/dalvikvm( 1189): Trying to load lib libjavacore.so 0x0
D/dalvikvm( 1189): Added shared lib libjavacore.so 0x0
D/dalvikvm( 1189): Trying to load lib libnativehelper.so 0x0
D/dalvikvm( 1189): Added shared lib libnativehelper.so 0x0
D/dalvikvm( 1189): No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
D/dalvikvm( 1189): Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
E/memtrack( 1189): Couldn't load memtrack module (No such file or directory)
E/android.os.Debug( 1189): failed to load memtrack module: -2
D/AndroidRuntime( 1189): Calling main entry com.android.commands.am.Am
I/ActivityManager( 361): Force stopping com.example.myproj appid=10051 user=0: from pid 1189
I/ActivityManager( 361): START u0 {flg=0x10000000 cmp=com.example.myproj/.MainActivity} from pid 1189
D/gralloc ( 51): Registering a buffer in the process that created it. This may cause memory ordering problems.
E/libEGL ( 51): called unimplemented OpenGL ES API
E/libEGL ( 51): called unimplemented OpenGL ES API
E/libEGL ( 51): called unimplemented OpenGL ES API
E/libEGL ( 51): called unimplemented OpenGL ES API
E/SurfaceFlinger( 51): glCheckFramebufferStatusOES error 1304732677
E/SurfaceFlinger( 51): got GL_FRAMEBUFFER_COMPLETE_OES error while taking screenshot
E/libEGL ( 51): called unimplemented OpenGL ES API
E/libEGL ( 51): called unimplemented OpenGL ES API
W/WindowManager( 361): Screenshot failure taking screenshot for (266x425) to layer 21005
I/ActivityManager( 361): Start proc com.example.myproj for activity com.example.myproj/.MainActivity: pid=1200 uid=10051 gids={50051, 1028, 1015}
D/dalvikvm( 1200): Not late-enabling CheckJNI (already on)
I/Choreographer( 361): Skipped 37 frames! The application may be doing too much work on its main thread.
I/Choreographer( 361): Skipped 33 frames! The application may be doing too much work on its main thread.
I/Choreographer( 531): Skipped 84 frames! The application may be doing too much work on its main thread.
W/dalvikvm( 1200): VFY: register1 v4 holds uninitialized ref
W/dalvikvm( 1200): VFY: bad arg 0 (into Ljava/lang/Object;)
W/dalvikvm( 1200): VFY: rejecting call to Lacteve/symbolic/Util;.write (Ljava/lang/Object;I)V
W/dalvikvm( 1200): VFY: rejecting opcode 0x71 at 0x000a
W/dalvikvm( 1200): VFY: rejected Lcom/example/myproj/MainActivity$1;.<init> (Lcom/example/myproj/MainActivity;)V
W/dalvikvm( 1200): Verifier rejected class Lcom/example/myproj/MainActivity$1;
D/AndroidRuntime( 1200): Shutting down VM
W/dalvikvm( 1200): threadid=1: thread exiting with uncaught exception (group=0xb3ae0b90)
E/AndroidRuntime( 1200): FATAL EXCEPTION: main
E/AndroidRuntime( 1200): Process: com.example.myproj, PID: 1200
E/AndroidRuntime( 1200): java.lang.VerifyError: com/example/myproj/MainActivity$1
E/AndroidRuntime( 1200): at com.example.myproj.MainActivity.dol(MainActivity.java:24)
E/AndroidRuntime( 1200): at com.example.myproj.MainActivity.onCreate(MainActivity.java:17)
E/AndroidRuntime( 1200): at android.app.Activity.performCreate(Activity.java:5243)
E/AndroidRuntime( 1200): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
E/AndroidRuntime( 1200): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2140)
E/AndroidRuntime( 1200): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
E/AndroidRuntime( 1200): at android.app.ActivityThread.access$700(ActivityThread.java:135)
E/AndroidRuntime( 1200): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
E/AndroidRuntime( 1200): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 1200): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 1200): at android.app.ActivityThread.main(ActivityThread.java:4998)
E/AndroidRuntime( 1200): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1200): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 1200): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
E/AndroidRuntime( 1200): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
E/AndroidRuntime( 1200): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 361): Force finishing activity com.example.myproj/.MainActivity
I/WindowManager( 361): Screenshot max retries 4 of Token{b4083168 ActivityRecord{b3ffc9c8 u0 com.example.myproj/.MainActivity t9 f}} appWin=Window{b401a348 u0 Starting com.example.myproj} drawState=4
W/WindowManager( 361): Screenshot failure taking screenshot for (800x1280) to layer 21010
W/ActivityManager( 361): Activity pause timeout for ActivityRecord{b3ffc9c8 u0 com.example.myproj/.MainActivity t9 f}
I/Choreographer( 361): Skipped 31 frames! The application may be doing too much work on its main thread.
E/WindowManager( 361): Starting window AppWindowToken{b41c65a8 token=Token{b4083168 ActivityRecord{b3ffc9c8 u0 com.example.myproj/.MainActivity t9}}} timed out
W/ActivityManager( 361): Activity destroy timeout for ActivityRecord{b3ffc9c8 u0 com.example.myproj/.MainActivity t9 f}
D/dalvikvm( 531): GC_CONCURRENT freed 894K, 16% free 5380K/6392K, paused 78ms+17ms, total 167ms
D/dalvikvm( 515): GC_CONCURRENT freed 322K, 12% free 3340K/3780K, paused 6ms+7ms, total 64ms
I/Process ( 1200): Sending signal. PID: 1200 SIG: 9
W/InputMethodManagerService( 361): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#b404f558 attribute=null, token = android.os.BinderProxy#b404fb70
I/ActivityManager( 361): Process com.example.myproj (pid 1200) has died.
D/ConnectivityService( 361): Sampling interval elapsed, updating statistics ..
D/ConnectivityService( 361): Done.
D/ConnectivityService( 361): Setting timer for 720seconds
D/dalvikvm( 515): GC_CONCURRENT freed 436K, 14% free 3290K/3792K, paused 4ms+5ms, total 41ms
D/AndroidRuntime( 1240):
D/AndroidRuntime( 1240): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime( 1240): CheckJNI is ON
D/dalvikvm( 1240): Trying to load lib libjavacore.so 0x0
D/dalvikvm( 1240): Added shared lib libjavacore.so 0x0
D/dalvikvm( 1240): Trying to load lib libnativehelper.so 0x0
D/dalvikvm( 1240): Added shared lib libnativehelper.so 0x0
D/dalvikvm( 1240): No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
D/dalvikvm( 1240): Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
E/memtrack( 1240): Couldn't load memtrack module (No such file or directory)
E/android.os.Debug( 1240): failed to load memtrack module: -2
D/AndroidRuntime( 1240): Calling main entry com.android.commands.am.Am
I/ActivityManager( 361): Force stopping com.example.myproj appid=10051 user=0: from pid 1240
I/ActivityManager( 361): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=logcat cmp=com.example.myproj/.MainActivity} from pid 1240
D/gralloc ( 51): Registering a buffer in the process that created it. This may cause memory ordering problems.
E/libEGL ( 51): called unimplemented OpenGL ES API
E/libEGL ( 51): called unimplemented OpenGL ES API
E/libEGL ( 51): called unimplemented OpenGL ES API
E/libEGL ( 51): called unimplemented OpenGL ES API
E/SurfaceFlinger( 51): glCheckFramebufferStatusOES error 1304732677
E/SurfaceFlinger( 51): got GL_FRAMEBUFFER_COMPLETE_OES error while taking screenshot
E/libEGL ( 51): called unimplemented OpenGL ES API
E/libEGL ( 51): called unimplemented OpenGL ES API
W/WindowManager( 361): Screenshot failure taking screenshot for (266x425) to layer 21005
I/ActivityManager( 361): Start proc com.example.myproj for activity com.example.myproj/.MainActivity: pid=1251 uid=10051 gids={50051, 1028, 1015}
D/dalvikvm( 1251): Not late-enabling CheckJNI (already on)
I/Choreographer( 361): Skipped 44 frames! The application may be doing too much work on its main thread.
W/dalvikvm( 1251): VFY: register1 v4 holds uninitialized ref
W/dalvikvm( 1251): VFY: bad arg 0 (into Ljava/lang/Object;)
W/dalvikvm( 1251): VFY: rejecting call to Lacteve/symbolic/Util;.write (Ljava/lang/Object;I)V
W/dalvikvm( 1251): VFY: rejecting opcode 0x71 at 0x000a
W/dalvikvm( 1251): VFY: rejected Lcom/example/myproj/MainActivity$1;.<init> (Lcom/example/myproj/MainActivity;)V
W/dalvikvm( 1251): Verifier rejected class Lcom/example/myproj/MainActivity$1;
D/AndroidRuntime( 1251): Shutting down VM
W/dalvikvm( 1251): threadid=1: thread exiting with uncaught exception (group=0xb3ae0b90)
E/AndroidRuntime( 1251): FATAL EXCEPTION: main
E/AndroidRuntime( 1251): Process: com.example.myproj, PID: 1251
E/AndroidRuntime( 1251): java.lang.VerifyError: com/example/myproj/MainActivity$1
E/AndroidRuntime( 1251): at com.example.myproj.MainActivity.dol(MainActivity.java:24)
E/AndroidRuntime( 1251): at com.example.myproj.MainActivity.onCreate(MainActivity.java:17)
E/AndroidRuntime( 1251): at android.app.Activity.performCreate(Activity.java:5243)
E/AndroidRuntime( 1251): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
E/AndroidRuntime( 1251): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2140)
E/AndroidRuntime( 1251): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
E/AndroidRuntime( 1251): at android.app.ActivityThread.access$700(ActivityThread.java:135)
E/AndroidRuntime( 1251): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
E/AndroidRuntime( 1251): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 1251): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 1251): at android.app.ActivityThread.main(ActivityThread.java:4998)
E/AndroidRuntime( 1251): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1251): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 1251): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
E/AndroidRuntime( 1251): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
E/AndroidRuntime( 1251): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 361): Force finishing activity com.example.myproj/.MainActivity
I/WindowManager( 361): Screenshot max retries 4 of Token{b41deb30 ActivityRecord{b4232990 u0 com.example.myproj/.MainActivity t10 f}} appWin=Window{b423e4b0 u0 Starting com.example.myproj} drawState=4
W/WindowManager( 361): Screenshot failure taking screenshot for (800x1280) to layer 21010
D/dalvikvm( 361): GC_CONCURRENT freed 1117K, 16% free 6529K/7720K, paused 16ms+34ms, total 347ms
W/ActivityManager( 361): Activity pause timeout for ActivityRecord{b4232990 u0 com.example.myproj/.MainActivity t10 f}
I/Choreographer( 531): Skipped 46 frames! The application may be doing too much work on its main thread.
D/LightsService( 361): Excessive delay setting light: 82ms
D/LightsService( 361): Excessive delay setting light: 426ms
I/Choreographer( 361): Skipped 37 frames! The application may be doing too much work on its main thread.
D/LightsService( 361): Excessive delay setting light: 1681ms
E/SoundPool( 361): error loading /system/media/audio/ui/Effect_Tick.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
E/SoundPool( 361): error loading /system/media/audio/ui/Effect_Tick.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
E/SoundPool( 361): error loading /system/media/audio/ui/Effect_Tick.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
E/SoundPool( 361): error loading /system/media/audio/ui/Effect_Tick.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
E/SoundPool( 361): error loading /system/media/audio/ui/Effect_Tick.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
E/SoundPool( 361): error loading /system/media/audio/ui/KeypressStandard.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/KeypressStandard.ogg
E/SoundPool( 361): error loading /system/media/audio/ui/KeypressSpacebar.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/KeypressSpacebar.ogg
E/SoundPool( 361): error loading /system/media/audio/ui/KeypressDelete.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/KeypressDelete.ogg
E/SoundPool( 361): error loading /system/media/audio/ui/KeypressReturn.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/KeypressReturn.ogg
E/SoundPool( 361): error loading /system/media/audio/ui/KeypressInvalid.ogg
W/AudioService( 361): Soundpool could not load file: /system/media/audio/ui/KeypressInvalid.ogg
W/AudioService( 361): onLoadSoundEffects(), Error -1 while loading samples
I/Process ( 1251): Sending signal. PID: 1251 SIG: 9
D/LightsService( 361): Excessive delay setting light: 320ms
D/LightsService( 361): Excessive delay setting light: 190ms
D/LightsService( 361): Excessive delay setting light: 73ms
I/ActivityManager( 361): Process com.example.myproj (pid 1251) has died.
W/InputMethodManagerService( 361): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#b3f8b170 attribute=null, token = android.os.BinderProxy#b404fb70
E/WindowManager( 361): Starting window AppWindowToken{b4233820 token=Token{b41deb30 ActivityRecord{b4232990 u0 com.example.myproj/.MainActivity t10}}} timed out
I/ActivityManager( 361): Killing 564:com.android.printspooler/u0a38 (adj 15): empty for 1807s
I/ProcessStatsService( 361): Prepared write state in 25ms
I/ProcessStatsService( 361): Prepared write state in 16ms
I am creating an app on Android, which involves an Activity and a service. One of the components of the service is meant to send a signal to the MainActivity, which will execute some specific code. The problem is, trying to send the intent makes the app crash.
Here is the code that sends the intent. Note that it resides in the inside of a doInBackground function of an AsyncTask object, which resides inside the said service:
#Override
protected String doInBackground(Socket... client) {
Intent received = new Intent();
received.setAction("com.mycompany.Messenger.MESSAGE_RECEIVED");
sendBroadcast(received);
}
Note that if I comment out sendBroadcast(received), the app does not crash.
Here is the handler of the Intent inside MainActivity (which has the name ChatBubbleActivity in my app):
public class MessageReceiver extends BroadcastReceiver {
#Override
public void onReceive(Context context, Intent intent) {
if(intent.getAction().equals(MESSAGE_RECEIVED)) {
String current_message = "Intent works!";
TextView textView = (TextView) findViewById(R.id.myText);
textView.setText(current_message);
}
}
}
And this is the declaration of the Receiver in manifest:
<receiver android:name=".ChatBubbleActivity$MessageReceiver">
<intent-filter>
<action android:name="com.mycompany.Messenger.MESSAGE_RECEIVED"/>
</intent-filter>
</receiver>
, inside the <activity> chunk.
What is it that I might be missing?
EDIT:New version of code based on answers, still crashing.
EDIT logcat:
02-04 16:17:32.444 487-489/? D/dalvikvm﹕ GC_CONCURRENT freed 1662K, 22% free 6885K/8728K, paused 2ms+2ms, total 42ms
02-04 16:17:32.876 1275-1275/? D/AndroidRuntime﹕ >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
02-04 16:17:32.912 1275-1275/? D/AndroidRuntime﹕ CheckJNI is OFF
02-04 16:17:32.960 1275-1275/? D/dalvikvm﹕ Trying to load lib libjavacore.so 0x0
02-04 16:17:32.964 1275-1275/? D/dalvikvm﹕ Added shared lib libjavacore.so 0x0
02-04 16:17:32.968 1275-1275/? D/dalvikvm﹕ Trying to load lib libnativehelper.so 0x0
02-04 16:17:32.972 1275-1275/? D/dalvikvm﹕ Added shared lib libnativehelper.so 0x0
02-04 16:17:32.972 1275-1275/? D/dalvikvm﹕ No JNI_OnLoad found in libnativehelper.so 0x0, skipping init
02-04 16:17:33.020 1275-1275/? D/dalvikvm﹕ Note: class Landroid/app/ActivityManagerNative; has 179 unimplemented (abstract) methods
02-04 16:17:33.128 1275-1275/? E/memtrack﹕ Couldn't load memtrack module (No such file or directory)
02-04 16:17:33.132 1275-1275/? E/android.os.Debug﹕ failed to load memtrack module: -2
02-04 16:17:33.264 1275-1275/? D/AndroidRuntime﹕ Calling main entry com.android.commands.am.Am
02-04 16:17:33.284 487-617/? I/ActivityManager﹕ START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.mycompany.messenger/com.mycompany.Messenger.ChatBubbleActivity} from pid 1275
02-04 16:17:33.692 1275-1275/? D/AndroidRuntime﹕ Shutting down VM
02-04 16:17:33.692 1275-1279/? D/dalvikvm﹕ GC_CONCURRENT freed 95K, 15% free 576K/676K, paused 1ms+0ms, total 1ms
02-04 16:17:33.884 487-538/? I/ActivityManager﹕ Start proc com.mycompany.messenger for activity com.mycompany.messenger/com.mycompany.Messenger.ChatBubbleActivity: pid=1286 uid=10059 gids={50059, 3003}
02-04 16:17:33.932 1286-1286/? D/dalvikvm﹕ Late-enabling CheckJNI
02-04 16:17:34.228 1286-1286/? D/dalvikvm﹕ GC_FOR_ALLOC freed 60K, 4% free 2873K/2992K, paused 6ms, total 7ms
02-04 16:17:34.236 1286-1286/? I/dalvikvm-heap﹕ Grow heap (frag case) to 3.338MB for 500412-byte allocation
02-04 16:17:34.248 1286-1295/? D/dalvikvm﹕ GC_FOR_ALLOC freed <1K, 4% free 3362K/3484K, paused 11ms, total 11ms
02-04 16:17:34.252 1286-1290/? D/dalvikvm﹕ GC_CONCURRENT freed 0K, 4% free 3362K/3484K, paused 1ms+0ms, total 5ms
02-04 16:17:34.696 1286-1286/? D/libEGL﹕ loaded /system/lib/egl/libEGL_genymotion.so
02-04 16:17:34.708 1286-1286/? D/﹕ HostConnection::get() New Host Connection established 0xb7944cb0, tid 1286
02-04 16:17:34.744 1286-1286/? D/libEGL﹕ loaded /system/lib/egl/libGLESv1_CM_genymotion.so
02-04 16:17:34.744 1286-1286/? D/libEGL﹕ loaded /system/lib/egl/libGLESv2_genymotion.so
02-04 16:17:34.816 1286-1286/? W/EGL_genymotion﹕ eglSurfaceAttrib not implemented
02-04 16:17:34.820 1286-1286/? E/OpenGLRenderer﹕ Getting MAX_TEXTURE_SIZE from GradienCache
02-04 16:17:34.824 1286-1286/? E/OpenGLRenderer﹕ MAX_TEXTURE_SIZE: 8192
02-04 16:17:34.848 1286-1286/? E/OpenGLRenderer﹕ Getting MAX_TEXTURE_SIZE from Caches::initConstraints()
02-04 16:17:34.848 1286-1286/? E/OpenGLRenderer﹕ MAX_TEXTURE_SIZE: 8192
02-04 16:17:34.852 1286-1286/? D/OpenGLRenderer﹕ Enabling debug mode 0
02-04 16:17:34.932 1286-1300/? W/dalvikvm﹕ threadid=12: thread exiting with uncaught exception (group=0xa4d31b20)
02-04 16:17:34.932 1286-1300/? E/AndroidRuntime﹕ FATAL EXCEPTION: AsyncTask #2
Process: com.mycompany.messenger, PID: 1286
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:300)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
Caused by: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
at android.app.ContextImpl.startActivity(ContextImpl.java:1050)
at android.app.ContextImpl.startActivity(ContextImpl.java:1037)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:311)
at com.mycompany.Messenger.LocalService$DownloadWebpageTask2.doInBackground(LocalService.java:118)
at com.mycompany.Messenger.LocalService$DownloadWebpageTask2.doInBackground(LocalService.java:113)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
02-04 16:17:34.936 487-617/? W/ActivityManager﹕ Force finishing activity com.mycompany.messenger/com.mycompany.Messenger.ChatBubbleActivity
02-04 16:17:35.180 487-840/? W/InputMethodManagerService﹕ Focus gain on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy#529ef2ac (uid=10059 pid=1286)
02-04 16:17:35.288 487-617/? I/WindowManager﹕ Screenshot max retries 4 of Token{52998cec ActivityRecord{5294f214 u0 com.mycompany.messenger/com.mycompany.Messenger.ChatBubbleActivity t4 f}} appWin=Window{52948c58 u0 Starting com.mycompany.messenger} drawState=4
02-04 16:17:35.288 487-617/? W/WindowManager﹕ Screenshot failure taking screenshot for (800x1280) to layer 21015
02-04 16:17:38.512 487-502/? I/Choreographer﹕ Skipped 188 frames! The application may be doing too much work on its main thread.
02-04 16:17:38.516 711-711/? I/Choreographer﹕ Skipped 185 frames! The application may be doing too much work on its main thread.
02-04 16:17:39.708 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
02-04 16:17:40.536 711-711/? W/EGL_genymotion﹕ eglSurfaceAttrib not implemented
02-04 16:17:41.260 487-502/? I/Choreographer﹕ Skipped 35 frames! The application may be doing too much work on its main thread.
02-04 16:17:49.560 1286-1300/? I/Process﹕ Sending signal. PID: 1286 SIG: 9
02-04 16:17:49.580 487-616/? W/InputMethodManagerService﹕ Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#52963b68 attribute=null, token = android.os.BinderProxy#5290713c
02-04 16:17:49.644 487-840/? I/ActivityManager﹕ Process com.mycompany.messenger (pid 1286) has died.
02-04 16:17:49.716 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
02-04 16:17:59.720 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
02-04 16:18:09.728 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
02-04 16:18:19.736 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
02-04 16:18:29.744 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
02-04 16:18:39.752 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
02-04 16:18:49.756 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
02-04 16:18:59.764 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
02-04 16:19:09.772 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
02-04 16:19:19.780 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
02-04 16:19:29.788 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
02-04 16:19:39.792 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
02-04 16:19:49.800 117-117/? D/local_opengl﹕ Select interrupted or nothing to read
Do you want to start an activity or send a broadcast? I don't understand your code.
You are starting an activity from a background thread, that's not allowed.
In your AsyncTask, the method protected String doInBackground(Socket... client) is the only one that doesn't run in the UI thread.
When ever you want to start your Broadcast Receiver you don't call it as an acitivty
Your Method
Intent received = new Intent(ChatBubbleActivity.MESSAGE_RECEIVED);
received.putExtra("current", "Intent is working!!");
startActivity(received);
What it should be
Intent intent = new Intent();
intent.setAction("com.tutorialspoint.CUSTOM_INTENT");
sendBroadcast(intent);
Have a look at these tutorials
Vogella
TutorialsPoint
i am trying to implement a Google map in my android app.Following is my code:
private GoogleMap googleMap;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.connect);
initilizeMap();
googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
googleMap.setMyLocationEnabled(true);
googleMap.getUiSettings().setZoomControlsEnabled(false);
googleMap.getUiSettings().setMyLocationButtonEnabled(true);
googleMap.getUiSettings().setCompassEnabled(true);
googleMap.getUiSettings().setRotateGesturesEnabled(true);
googleMap.getUiSettings().setZoomGesturesEnabled(true);
}
private void initilizeMap() {
if (googleMap == null) {
googleMap = ((MapFragment) getFragmentManager().findFragmentById(
R.id.map)).getMap();
// check if map is created successfully or not
if (googleMap == null) {
Toast.makeText(getApplicationContext(),
"Sorry! unable to create maps", Toast.LENGTH_SHORT)
.show();
}
}
and my xml file:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<fragment
android:id="#+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
Logcat error:
07-24 07:27:44.636: E/SoundPool(382): error loading /system/media/audio/ui/Effect_Tick.ogg
07-24 07:27:44.636: W/AudioService(382): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
07-24 07:27:44.646: E/SoundPool(382): error loading /system/media/audio/ui/Effect_Tick.ogg
07-24 07:27:44.646: W/AudioService(382): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
07-24 07:27:44.646: E/SoundPool(382): error loading /system/media/audio/ui/Effect_Tick.ogg
07-24 07:27:44.646: W/AudioService(382): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
07-24 07:27:44.646: E/SoundPool(382): error loading /system/media/audio/ui/Effect_Tick.ogg
07-24 07:27:44.646: W/AudioService(382): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
07-24 07:27:44.646: E/SoundPool(382): error loading /system/media/audio/ui/Effect_Tick.ogg
07-24 07:27:44.646: W/AudioService(382): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
07-24 07:27:44.656: E/SoundPool(382): error loading /system/media/audio/ui/KeypressStandard.ogg
07-24 07:27:44.656: W/AudioService(382): Soundpool could not load file: /system/media/audio/ui/KeypressStandard.ogg
07-24 07:27:44.676: E/SoundPool(382): error loading /system/media/audio/ui/KeypressSpacebar.ogg
07-24 07:27:44.676: W/AudioService(382): Soundpool could not load file: /system/media/audio/ui/KeypressSpacebar.ogg
07-24 07:27:44.676: E/SoundPool(382): error loading /system/media/audio/ui/KeypressDelete.ogg
07-24 07:27:44.686: W/AudioService(382): Soundpool could not load file: /system/media/audio/ui/KeypressDelete.ogg
07-24 07:27:44.686: E/SoundPool(382): error loading /system/media/audio/ui/KeypressReturn.ogg
07-24 07:27:44.686: W/AudioService(382): Soundpool could not load file: /system/media/audio/ui/KeypressReturn.ogg
07-24 07:27:44.686: E/SoundPool(382): error loading /system/media/audio/ui/KeypressInvalid.ogg
07-24 07:27:44.686: W/AudioService(382): Soundpool could not load file: /system/media/audio/ui/KeypressInvalid.ogg
07-24 07:27:44.686: W/AudioService(382): onLoadSoundEffects(), Error -1 while loading samples
07-24 07:27:46.426: W/Response(1358): {"GET":[],"POST":{"action":"login","app_secret":"jkhljkUILJGJkljhkjUGLG87796587687HGKJhghkjKUYGKJHjhgjUYGKUY7865876hgKUYGK","email":"a","password":"aa"},"status":"ERROR","msg":"Sorry ! Invalid Username or Password"}
07-24 07:27:46.526: I/ActivityManager(382): START u0 {cmp=example.atlcitylimo/.Home} from pid 1358
07-24 07:27:46.686: I/Choreographer(1358): Skipped 31 frames! The application may be doing too much work on its main thread.
07-24 07:27:46.966: E/dalvikvm(1358): Could not find class 'com.google.android.gms.maps.MapFragment', referenced from method example.atlcitylimo.Home.initilizeMap
07-24 07:27:46.976: W/dalvikvm(1358): VFY: unable to resolve check-cast 992 (Lcom/google/android/gms/maps/MapFragment;) in Lexample/atlcitylimo/Home;
07-24 07:27:46.976: D/dalvikvm(1358): VFY: replacing opcode 0x1f at 0x000f
07-24 07:27:47.036: I/dalvikvm(1358): Could not find method com.google.android.gms.maps.GoogleMap.setMapType, referenced from method example.atlcitylimo.Home.onCreate
07-24 07:27:47.036: W/dalvikvm(1358): VFY: unable to resolve virtual method 8258: Lcom/google/android/gms/maps/GoogleMap;.setMapType (I)V
07-24 07:27:47.086: D/dalvikvm(1358): VFY: replacing opcode 0x6e at 0x0042
07-24 07:27:47.386: D/dalvikvm(1358): GC_FOR_ALLOC freed 235K, 6% free 5764K/6080K, paused 86ms, total 88ms
07-24 07:27:47.386: I/dalvikvm-heap(1358): Grow heap (frag case) to 8.048MB for 2457616-byte allocation
07-24 07:27:47.526: D/dalvikvm(1358): GC_FOR_ALLOC freed 1K, 4% free 8162K/8484K, paused 138ms, total 138ms
07-24 07:27:48.956: D/AndroidRuntime(1358): Shutting down VM
07-24 07:27:48.956: W/dalvikvm(1358): threadid=1: thread exiting with uncaught exception (group=0xb3a75ba8)
07-24 07:27:49.056: E/AndroidRuntime(1358): FATAL EXCEPTION: main
07-24 07:27:49.056: E/AndroidRuntime(1358): Process: example.atlcitylimo, PID: 1358
07-24 07:27:49.056: E/AndroidRuntime(1358): java.lang.RuntimeException: Unable to start activity ComponentInfo{example.atlcitylimo/example.atlcitylimo.Home}: android.view.InflateException: Binary XML file line #16: Error inflating class fragment
07-24 07:27:49.056: E/AndroidRuntime(1358): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
07-24 07:27:49.056: E/AndroidRuntime(1358): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
07-24 07:27:49.056: E/AndroidRuntime(1358): at android.app.ActivityThread.access$800(ActivityThread.java:135)
07-24 07:27:49.056: E/AndroidRuntime(1358): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
07-24 07:27:49.056: E/AndroidRuntime(1358): at android.os.Handler.dispatchMessage(Handler.java:102)
07-24 07:27:49.056: E/AndroidRuntime(1358): at android.os.Looper.loop(Looper.java:136)
07-24 07:27:49.056: E/AndroidRuntime(1358): at android.app.ActivityThread.main(ActivityThread.java:5017)
07-24 07:27:49.056: E/AndroidRuntime(1358): at java.lang.reflect.Method.invokeNative(Native Method)
07-24 07:27:49.056: E/AndroidRuntime(1358): at java.lang.reflect.Method.invoke(Method.java:515)
07-24 07:27:49.056: E/AndroidRuntime(1358): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
07-24 07:27:49.056: E/AndroidRuntime(1358): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
07-24 07:27:49.056: E/AndroidRuntime(1358): at dalvik.system.NativeStart.main(Native Method)
07-24 07:27:49.056: E/AndroidRuntime(1358): Caused by: android.view.InflateException: Binary XML file line #16: Error inflating class fragment
07-24 07:27:49.056: E/AndroidRuntime(1358): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
07-24 07:27:49.056: E/AndroidRuntime(1358): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
07-24 07:27:49.056: E/AndroidRuntime(1358): at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
07-24 07:27:49.056: E/AndroidRuntime(1358): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
07-24 07:27:49.056: E/AndroidRuntime(1358): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
07-24 07:27:49.056: E/AndroidRuntime(1358): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
07-24 07:27:49.056: E/AndroidRuntime(1358): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
07-24 07:27:49.056: E/AndroidRuntime(1358): at android.app.Activity.setContentView(Activity.java:1929)
07-24 07:27:49.056: E/AndroidRuntime(1358): at example.atlcitylimo.Home.onCreate(Home.java:45)
07-24 07:27:49.056: E/AndroidRuntime(1358): at android.app.Activity.performCreate(Activity.java:5231)
07-24 07:27:49.056: E/AndroidRuntime(1358): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
07-24 07:27:49.056: E/AndroidRuntime(1358): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
07-24 07:27:49.056: E/AndroidRuntime(1358): ... 11 more
07-24 07:27:49.056: E/AndroidRuntime(1358): Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.MapFragment: make sure class name exists, is public, and has an empty constructor that is public
07-24 07:27:49.056: E/AndroidRuntime(1358): at android.app.Fragment.instantiate(Fragment.java:597)
07-24 07:27:49.056: E/AndroidRuntime(1358): at android.app.Fragment.instantiate(Fragment.java:561)
07-24 07:27:49.056: E/AndroidRuntime(1358): at android.app.Activity.onCreateView(Activity.java:4778)
07-24 07:27:49.056: E/AndroidRuntime(1358): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
07-24 07:27:49.056: E/AndroidRuntime(1358): ... 22 more
07-24 07:27:49.056: E/AndroidRuntime(1358): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.maps.MapFragment" on path: DexPathList[[zip file "/data/app/example.atlcitylimo-1.apk"],nativeLibraryDirectories=[/data/app-lib/example.atlcitylimo-1, /vendor/lib, /system/lib]]
07-24 07:27:49.056: E/AndroidRuntime(1358): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
07-24 07:27:49.056: E/AndroidRuntime(1358): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
07-24 07:27:49.056: E/AndroidRuntime(1358): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
07-24 07:27:49.056: E/AndroidRuntime(1358): at android.app.Fragment.instantiate(Fragment.java:583)
07-24 07:27:49.056: E/AndroidRuntime(1358): ... 25 more
07-24 07:27:49.476: W/ActivityManager(382): Force finishing activity example.atlcitylimo/.Home
07-24 07:27:49.526: W/ActivityManager(382): Force finishing activity example.atlcitylimo/.Main
07-24 07:27:49.796: D/dalvikvm(382): GC_FOR_ALLOC freed 517K, 20% free 6664K/8264K, paused 132ms, total 135ms
07-24 07:27:49.796: I/dalvikvm-heap(382): Grow heap (frag case) to 7.196MB for 635812-byte allocation
07-24 07:27:49.926: D/dalvikvm(382): GC_FOR_ALLOC freed 3K, 19% free 7282K/8888K, paused 134ms, total 134ms
07-24 07:27:49.936: I/Choreographer(382): Skipped 44 frames! The application may be doing too much work on its main thread.
07-24 07:27:50.806: I/Choreographer(382): Skipped 71 frames! The application may be doing too much work on its main thread.
07-24 07:27:50.976: W/ActivityManager(382): Activity pause timeout for ActivityRecord{b3fc3d40 u0 example.atlcitylimo/.Home t2 f}
07-24 07:27:51.386: I/Choreographer(382): Skipped 151 frames! The application may be doing too much work on its main thread.
07-24 07:27:51.496: I/Choreographer(554): Skipped 96 frames! The application may be doing too much work on its main thread.
07-24 07:27:51.516: I/Choreographer(382): Skipped 35 frames! The application may be doing too much work on its main thread.
07-24 07:27:51.946: I/Choreographer(382): Skipped 119 frames! The application may be doing too much work on its main thread.
07-24 07:27:52.406: D/dalvikvm(554): GC_FOR_ALLOC freed 445K, 16% free 5555K/6564K, paused 65ms, total 70ms
07-24 07:27:52.836: I/Choreographer(382): Skipped 38 frames! The application may be doing too much work on its main thread.
07-24 07:27:53.096: I/Choreographer(382): Skipped 41 frames! The application may be doing too much work on its main thread.
07-24 07:27:53.196: I/ActivityManager(382): Killing 860:com.android.music/u0a35 (adj 15): empty #17
07-24 07:27:53.466: I/Choreographer(382): Skipped 33 frames! The application may be doing too much work on its main thread.
07-24 07:27:53.486: W/MediaFocusControl(382): RemoteControlClient died
07-24 07:28:03.166: W/ActivityManager(382): Activity destroy timeout for ActivityRecord{b40820e0 u0 example.atlcitylimo/.Main t2 f}
07-24 07:28:03.216: W/ActivityManager(382): Activity destroy timeout for ActivityRecord{b3fc3d40 u0 example.atlcitylimo/.Home t2 f}
07-24 07:28:04.626: I/Process(1358): Sending signal. PID: 1358 SIG: 9
07-24 07:28:04.646: E/SoundPool(382): error loading /system/media/audio/ui/Effect_Tick.ogg
07-24 07:28:04.646: W/AudioService(382): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
07-24 07:28:04.656: E/SoundPool(382): error loading /system/media/audio/ui/Effect_Tick.ogg
07-24 07:28:04.656: W/AudioService(382): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
07-24 07:28:04.656: E/SoundPool(382): error loading /system/media/audio/ui/Effect_Tick.ogg
07-24 07:28:04.656: W/AudioService(382): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
07-24 07:28:04.656: E/SoundPool(382): error loading /system/media/audio/ui/Effect_Tick.ogg
07-24 07:28:04.656: W/AudioService(382): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
07-24 07:28:04.676: E/SoundPool(382): error loading /system/media/audio/ui/Effect_Tick.ogg
07-24 07:28:04.676: W/AudioService(382): Soundpool could not load file: /system/media/audio/ui/Effect_Tick.ogg
07-24 07:28:04.726: E/SoundPool(382): error loading /system/media/audio/ui/KeypressStandard.ogg
07-24 07:28:04.726: W/AudioService(382): Soundpool could not load file: /system/media/audio/ui/KeypressStandard.ogg
07-24 07:28:04.776: E/SoundPool(382): error loading /system/media/audio/ui/KeypressSpacebar.ogg
07-24 07:28:04.776: W/AudioService(382): Soundpool could not load file: /system/media/audio/ui/KeypressSpacebar.ogg
07-24 07:28:04.776: E/SoundPool(382): error loading /system/media/audio/ui/KeypressDelete.ogg
07-24 07:28:04.776: W/AudioService(382): Soundpool could not load file: /system/media/audio/ui/KeypressDelete.ogg
07-24 07:28:04.786: E/SoundPool(382): error loading /system/media/audio/ui/KeypressReturn.ogg
07-24 07:28:04.786: W/AudioService(382): Soundpool could not load file: /system/media/audio/ui/KeypressReturn.ogg
07-24 07:28:04.786: E/SoundPool(382): error loading /system/media/audio/ui/KeypressInvalid.ogg
07-24 07:28:04.786: W/AudioService(382): Soundpool could not load file: /system/media/audio/ui/KeypressInvalid.ogg
07-24 07:28:04.786: W/AudioService(382): onLoadSoundEffects(), Error -1 while loading samples
07-24 07:28:04.826: I/Choreographer(382): Skipped 52 frames! The application may be doing too much work on its main thread.
07-24 07:28:05.106: I/Choreographer(382): Skipped 31 frames! The application may be doing too much work on its main thread.
07-24 07:28:05.236: I/Choreographer(382): Skipped 30 frames! The application may be doing too much work on its main thread.
07-24 07:28:05.356: I/ActivityManager(382): Process example.atlcitylimo (pid 1358) has died.
07-24 07:28:05.436: I/WindowState(382): WIN DEATH: Window{b408a908 u0 example.atlcitylimo/example.atlcitylimo.Main}
07-24 07:28:05.526: I/WindowState(382): WIN DEATH: Window{b3fdbc30 u0 Toast}
I have even added API key in my MANIFEST file . I have imported Google play library files and almost everything done. But its not running .The project directly crash. I have installed Google play service too. what can be done? Can anyone please help? its an emergency.
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Add this line to your manifest.
I had similar problem of implementing the map inside a fragment. So i made a FrameLayout layout file and used com.google.android.gms.maps.MapView instead of Mapfragment.
You can have a look here
It works with support libraries as well
Your logcat says that it can't locate MapFragment
In your XML change change android:name to class
So your XML should look like this
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment" />
Im' trying to implement a drawer menu on my Android + HoloEverywhere app.
I'v used the method described on http://developer.android.com/training/implementing-navigation/nav-drawer.html to get started. The only difference is that I import a org.holoeverywhere.widget.ListView instead oh the classic ListView.
Here is my MainActivity :
import android.support.v4.app.FragmentManager;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.view.Menu;
import com.googlecode.androidannotations.annotations.AfterViews;
import com.googlecode.androidannotations.annotations.EActivity;
import com.googlecode.androidannotations.annotations.ViewById;
import org.holoeverywhere.app.Activity;
import org.holoeverywhere.widget.ArrayAdapter;
import org.holoeverywhere.widget.DrawerLayout;
import org.holoeverywhere.widget.ListView;
#EActivity(R.layout.activity_main)
public class MainActivity
extends Activity {
// Declare Variables
ActionBar mActionBar;
#ViewById(R.id.drawer_layout)
DrawerLayout mDrawer;
#ViewById(R.id.left_drawer)
ListView mDrawerList;
private String[] mPlanetTitles;
#AfterViews
protected void useElements() {
// Activate Navigation Mode Tabs
mActionBar = getSupportActionBar();
// Locate ViewPager in activity_main.xml
mPlanetTitles = getResources().getStringArray(R.array.planets_array);
// Activate Fragment Manager
FragmentManager fm = getSupportFragmentManager();
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.drawer_list_item, mPlanetTitles);
// Set the adapter for the list view
mDrawerList.setAdapter(adapter);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
getSupportMenuInflater().inflate(R.menu.activity_main, menu);
return super.onCreateOptionsMenu(menu);
}
}
And my activity_main.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<org.holoeverywhere.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- The main content view -->
<FrameLayout
android:id="#+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- The navigation drawer -->
<ListView
android:id="#+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#111"
android:choiceMode="singleChoice"
android:divider="#android:color/transparent"
android:dividerHeight="0dp" />
</org.holoeverywhere.widget.DrawerLayout>
EDIT
drawer_list_item.xml :
<!--
Copyright 2013 The Android Open Source Project
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.
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:gravity="center_vertical"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:textColor="#fff"
android:background="?android:attr/activatedBackgroundIndicator"
android:minHeight="?android:attr/listPreferredItemHeightSmall"/>
This code is supposed to show me the drawer with the list of planets inside. It works well on Android 4.x devices beacause the HoloEverywhere classes are not used. But on 2.x it crashes opening with the following exception :
11-25 14:09:24.771: E/AndroidRuntime(21797): FATAL EXCEPTION: main
11-25 14:09:24.771: E/AndroidRuntime(21797): android.view.InflateException: Binary XML file line #17: Error inflating class <unknown>
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.LayoutInflater._createView(LayoutInflater.java:382)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.LayoutInflater.onCreateView(LayoutInflater.java:594)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.LayoutInflater.createViewFromTag(LayoutInflater.java:444)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:529)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.LayoutInflater.inflate(LayoutInflater.java:488)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:184)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.widget.ArrayAdapter.getView(ArrayAdapter.java:256)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.widget.ListAdapterWrapper.getView(ListAdapterWrapper.java:83)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.widget.AbsListView.obtainView(AbsListView.java:1519)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.widget.ListView.makeAndAddView(ListView.java:1749)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.widget.ListView.fillDown(ListView.java:674)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.widget.ListView.fillFromTop(ListView.java:731)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.widget.ListView.layoutChildren(ListView.java:1602)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.widget.AbsListView.onLayout(AbsListView.java:1349)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.widget.ListView.onLayout(ListView.java:552)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.view.View.layout(View.java:7320)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:714)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.view.View.layout(View.java:7320)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.widget.RelativeLayout.onLayout(RelativeLayout.java:912)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.view.View.layout(View.java:7320)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.widget.FrameLayout.onLayout(FrameLayout.java:342)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.view.View.layout(View.java:7320)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.widget.FrameLayout.onLayout(FrameLayout.java:342)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.view.View.layout(View.java:7320)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.widget.LinearLayout.setChildFrame(LinearLayout.java:1126)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.widget.LinearLayout.layoutVertical(LinearLayout.java:583)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.widget.LinearLayout.onLayout(LinearLayout.java:1096)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.view.View.layout(View.java:7320)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.widget.FrameLayout.onLayout(FrameLayout.java:342)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.view.View.layout(View.java:7320)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.widget.FrameLayout.onLayout(FrameLayout.java:342)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.view.View.layout(View.java:7320)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.view.ViewRoot.performTraversals(ViewRoot.java:1162)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.view.ViewRoot.handleMessage(ViewRoot.java:1882)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.os.Handler.dispatchMessage(Handler.java:99)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.os.Looper.loop(Looper.java:130)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.app.ActivityThread.main(ActivityThread.java:3701)
11-25 14:09:24.771: E/AndroidRuntime(21797): at java.lang.reflect.Method.invokeNative(Native Method)
11-25 14:09:24.771: E/AndroidRuntime(21797): at java.lang.reflect.Method.invoke(Method.java:507)
11-25 14:09:24.771: E/AndroidRuntime(21797): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
11-25 14:09:24.771: E/AndroidRuntime(21797): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
11-25 14:09:24.771: E/AndroidRuntime(21797): at dalvik.system.NativeStart.main(Native Method)
11-25 14:09:24.771: E/AndroidRuntime(21797): Caused by: java.lang.reflect.InvocationTargetException
11-25 14:09:24.771: E/AndroidRuntime(21797): at java.lang.reflect.Constructor.constructNative(Native Method)
11-25 14:09:24.771: E/AndroidRuntime(21797): at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.LayoutInflater._createView(LayoutInflater.java:358)
11-25 14:09:24.771: E/AndroidRuntime(21797): ... 41 more
11-25 14:09:24.771: E/AndroidRuntime(21797): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x10102fd a=-1}
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.content.res.Resources.loadDrawable(Resources.java:1692)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.view.View.<init>(View.java:1975)
11-25 14:09:24.771: E/AndroidRuntime(21797): at android.widget.TextView.<init>(TextView.java:370)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.widget.TextView.<init>(TextView.java:133)
11-25 14:09:24.771: E/AndroidRuntime(21797): at org.holoeverywhere.widget.TextView.<init>(TextView.java:129)
11-25 14:09:24.771: E/AndroidRuntime(21797): ... 44 more
11-25 14:09:24.831: W/ActivityManager(265): Force finishing activity com.board/.ui.activity.MainActivity_
11-25 14:09:25.341: W/ActivityManager(265): Activity pause timeout for HistoryRecord{2b3d55d8 com.board/.ui.activity.MainActivity_}
11-25 14:09:34.461: D/dalvikvm(21486): GC_EXPLICIT freed 52K, 49% free 2759K/5379K, external 1685K/2133K, paused 94ms
11-25 14:09:35.391: W/ActivityManager(265): Activity destroy timeout for HistoryRecord{2b3d55d8 com.board/.ui.activity.MainActivity_}
11-25 14:09:39.471: D/dalvikvm(21499): GC_EXPLICIT freed 302K, 45% free 3316K/6023K, external 1757K/2133K, paused 106ms
11-25 14:09:44.461: D/dalvikvm(21544): GC_EXPLICIT freed 143K, 48% free 2862K/5447K, external 1685K/2133K, paused 95ms
11-25 14:09:49.471: D/dalvikvm(21578): GC_EXPLICIT freed 806K, 49% free 3462K/6663K, external 1685K/2133K, paused 108ms
11-25 14:09:59.291: D/dalvikvm(7039): GC_EXPLICIT freed 6K, 46% free 3389K/6215K, external 1685K/2133K, paused 138ms
11-25 14:10:00.131: D/dalvikvm(1091): GC_EXPLICIT freed 3K, 49% free 2786K/5379K, external 1845K/2133K, paused 83ms
11-25 14:10:00.181: D/dalvikvm(343): GC_CONCURRENT freed 777K, 54% free 3267K/7047K, external 2542K/3017K, paused 2ms+9ms
11-25 14:10:00.201: D/dalvikvm(1091): GC_EXPLICIT freed 7K, 49% free 2788K/5379K, external 1981K/2133K, paused 28ms
11-25 14:10:04.161: D/SntpClient(265): request time failed: java.net.SocketTimeoutException: Try again
11-25 14:10:05.331: D/dalvikvm(21245): GC_EXPLICIT freed 179K, 50% free 3314K/6535K, external 1685K/2133K, paused 123ms
If I comment the line :
mDrawerList.setAdapter(adapter);
in my MainActivity, it runs on 2.x and I get a blank drawer.
The problem was in drawer_list_item.xml. In Android 2.x the style attributes starting with "?android:attr/" were not available. Removing them fixed the problem.
I'm currently try to run some opencv filters (i.e find egde, Median, ...) on images which are stored in the image gallery folder.
But I get error for loading image. My device is galaxy tab 10.1 with android 3.2, my opencv - API level 8.
I have the following source on a Button:
#Override
public void onClick(View v) {
Bitmap myBitmap = BitmapFactory.decodeFile("/sdcard/image1.jpg");
Bitmap myBitmap32 = myBitmap.copy(Bitmap.Config.ARGB_8888, true);
Mat pic1 = Utils.bitmapToMat(myBitmap32);
}
Here is LogCat:
02-07 12:31:27.290: I/System.out(16522): Not a DRM File, opening notmally
02-07 12:31:27.290: I/System.out(16522): buffer returned
02-07 12:31:27.310: D/dalvikvm(16522): GC_FOR_ALLOC freed 11K, 21% free 6975K/8775K, paused 19ms
02-07 12:31:27.320: I/dalvikvm-heap(16522): Grow heap (frag case) to 12.918MB for 6291472-byte allocation
02-07 12:31:27.340: D/dalvikvm(16522): GC_FOR_ALLOC freed <1K, 13% free 13119K/14983K, paused 19ms
02-07 12:31:27.380: D/dalvikvm(16522): GC_CONCURRENT freed 0K, 13% free 13119K/14983K, paused 2ms+2ms
02-07 12:31:27.710: D/dalvikvm(16522): GC_FOR_ALLOC freed 55K, 13% free 13063K/14983K, paused 20ms
02-07 12:31:27.730: I/dalvikvm-heap(16522): Grow heap (frag case) to 24.864MB for 12582928-byte allocation
02-07 12:31:27.780: D/dalvikvm(16522): GC_FOR_ALLOC freed 0K, 8% free 25351K/27335K, paused 21ms
02-07 12:31:27.830: D/dalvikvm(16522): GC_CONCURRENT freed <1K, 8% free 25351K/27335K, paused 2ms+3ms
02-07 12:31:27.890: W/dalvikvm(16522): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lorg/opencv/android/Utils;
02-07 12:31:27.890: D/AndroidRuntime(16522): Shutting down VM
02-07 12:31:27.890: W/dalvikvm(16522): threadid=1: thread exiting with uncaught exception (group=0x400fc760)
02-07 12:31:27.890: E/AndroidRuntime(16522): FATAL EXCEPTION: main
02-07 12:31:27.890: E/AndroidRuntime(16522): java.lang.ExceptionInInitializerError
02-07 12:31:27.890: E/AndroidRuntime(16522): at photo.klu.PhotoKLUActivity$1.onClick(PhotoKLUActivity.java:82)
02-07 12:31:27.890: E/AndroidRuntime(16522): at android.view.View.performClick(View.java:3127)
02-07 12:31:27.890: E/AndroidRuntime(16522): at android.view.View$PerformClick.run(View.java:12025)
02-07 12:31:27.890: E/AndroidRuntime(16522): at android.os.Handler.handleCallback(Handler.java:587)
02-07 12:31:27.890: E/AndroidRuntime(16522): at android.os.Handler.dispatchMessage(Handler.java:92)
02-07 12:31:27.890: E/AndroidRuntime(16522): at android.os.Looper.loop(Looper.java:132)
02-07 12:31:27.890: E/AndroidRuntime(16522): at android.app.ActivityThread.main(ActivityThread.java:4126)
02-07 12:31:27.890: E/AndroidRuntime(16522): at java.lang.reflect.Method.invokeNative(Native Method)
02-07 12:31:27.890: E/AndroidRuntime(16522): at java.lang.reflect.Method.invoke(Method.java:491)
02-07 12:31:27.890: E/AndroidRuntime(16522): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
02-07 12:31:27.890: E/AndroidRuntime(16522): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
02-07 12:31:27.890: E/AndroidRuntime(16522): at dalvik.system.NativeStart.main(Native Method)
02-07 12:31:27.890: E/AndroidRuntime(16522): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load opencv_java: findLibrary returned null
02-07 12:31:27.890: E/AndroidRuntime(16522): at java.lang.Runtime.loadLibrary(Runtime.java:425)
02-07 12:31:27.890: E/AndroidRuntime(16522): at java.lang.System.loadLibrary(System.java:554)
02-07 12:31:27.890: E/AndroidRuntime(16522): at org.opencv.android.Utils.<clinit>(Utils.java:86)
02-07 12:31:27.890: E/AndroidRuntime(16522): ... 12 more
02-07 12:31:30.010: I/dalvikvm(16522): threadid=4: reacting to signal 3
02-07 12:31:30.010: I/dalvikvm(16522): Wrote stack traces to '/data/anr/traces.txt'
02-07 12:31:37.470: I/Process(16522): Sending signal. PID: 16522 SIG: 9
Any ideas?
Thank you.
The openCV library is not attached to your application. Please do the following (i assume that the openCV library is imported to your workspace). On Package Explorer > Right click on the application project > properties > under Library click Add > select openCV Be sure that on Java Build Path you don't have anything related to openCV