问题
The following code crashes with the included thread dump on Android 4.1.2 (on a Sprint Note II).
CookieManager.getInstance().removeExpiredCookie()
Dump:
12-12 13:45:35.484 1551-2908/com.example.myapp W/dalvikvm﹕ Invalid indirect reference 0x4276f3d8 in decodeIndirectRef
12-12 13:45:35.484 1551-2908/com.example.myapp E/dalvikvm﹕ VM aborting
12-12 13:45:35.484 1551-2908/com.example.myapp A/libc﹕ Fatal signal 11 (SIGSEGV) at 0xdeadd00d (code=1), thread 2908 (AsyncTask #2)
12-12 13:45:35.584 16476-16476/? I/DEBUG﹕ *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-12 13:45:35.584 16476-16476/? I/DEBUG﹕ Build fingerprint: 'samsung/t0ltespr/t0ltespr:4.1.2/JZO54K/L900VPAMC2:user/release-keys'
12-12 13:45:35.584 16476-16476/? I/DEBUG﹕ pid: 1551, tid: 2908, name: AsyncTask #2 >>> com.example.myapp <<<
12-12 13:45:35.584 16476-16476/? I/DEBUG﹕ signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadd00d
12-12 13:45:35.659 16476-16476/? I/DEBUG﹕ r0 00000000 r1 00000000 r2 deadd00d r3 00000000
12-12 13:45:35.659 16476-16476/? I/DEBUG﹕ r4 408c31a8 r5 0000020c r6 4276f3d8 r7 40863fbd
12-12 13:45:35.659 16476-16476/? I/DEBUG﹕ r8 4276f3d8 r9 40069a6c sl 58904738 fp 5fbfac84
12-12 13:45:35.659 16476-16476/? I/DEBUG﹕ ip 00004000 sp 5fbfa960 lr 40033c95 pc 4085ee50 cpsr 60000030
12-12 13:45:35.659 16476-16476/? I/DEBUG﹕ d0 bff0000000000000 d1 bff0000000000000
12-12 13:45:35.659 16476-16476/? I/DEBUG﹕ d2 410ca0004114a000 d3 c2040000ffffffdf
12-12 13:45:35.659 16476-16476/? I/DEBUG﹕ d4 c2059800c2039800 d5 412000000000000a
12-12 13:45:35.659 16476-16476/? I/DEBUG﹕ d6 c21c0000ffffffd9 d7 4210000042100000
12-12 13:45:35.659 16476-16476/? I/DEBUG﹕ d8 0000000000000000 d9 0000000000000000
12-12 13:45:35.659 16476-16476/? I/DEBUG﹕ d10 0000000000000000 d11 0000000000000000
12-12 13:45:35.659 16476-16476/? I/DEBUG﹕ d12 0000000000000000 d13 0000000000000000
12-12 13:45:35.659 16476-16476/? I/DEBUG﹕ d14 0000000000000000 d15 0000000000000000
12-12 13:45:35.659 16476-16476/? I/DEBUG﹕ d16 000000c1421a1640 d17 000000c1427680c8
12-12 13:45:35.659 16476-16476/? I/DEBUG﹕ d18 00000000006c9688 d19 2000000840072f00
12-12 13:45:35.659 16476-16476/? I/DEBUG﹕ d20 c038000000000000 d21 3ff0000000000000
12-12 13:45:35.659 16476-16476/? I/DEBUG﹕ d22 0000000000000000 d23 3ff0000000000000
12-12 13:45:35.659 16476-16476/? I/DEBUG﹕ d24 3ff0000000000000 d25 0000000000000000
12-12 13:45:35.659 16476-16476/? I/DEBUG﹕ d26 0000000000000000 d27 0000000000000000
12-12 13:45:35.659 16476-16476/? I/DEBUG﹕ d28 0000000000000029 d29 0000000000000000
12-12 13:45:35.659 16476-16476/? I/DEBUG﹕ d30 0000000000000000 d31 0000000000000008
12-12 13:45:35.659 16476-16476/? I/DEBUG﹕ scr 60000011
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ backtrace:
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ #00 pc 00045e50 /system/lib/libdvm.so (dvmAbort+75)
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ #01 pc 00049f9f /system/lib/libdvm.so (dvmDecodeIndirectRef(Thread*, _jobject*)+210)
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ #02 pc 0004ae3d /system/lib/libdvm.so
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ #03 pc 00298e0d /system/lib/libwebcore.so
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ #04 pc 0028cc6d /system/lib/libwebcore.so
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ #05 pc 0028cd49 /system/lib/libwebcore.so
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ #06 pc 002934d7 /system/lib/libwebcore.so
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ #07 pc 0001deb0 /system/lib/libdvm.so (dvmPlatformInvoke+112)
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ #08 pc 0004d103 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+394)
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ #09 pc 00027324 /system/lib/libdvm.so
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ #10 pc 000fedd8 <unknown>
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ stack:
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa920 00000001
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa924 40062d10
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa928 40062d10
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa92c 40062d10
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa930 40062d10
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa934 40033c95 /system/lib/libc.so (__sflush_locked+36)
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa938 4005d774 /system/lib/libc.so
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa93c 40062d10
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa940 00000000
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa944 40034c65 /system/lib/libc.so (_fwalk+32)
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa948 408c31a8 /system/lib/libdvm.so
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa94c 0000020c
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa950 4276f3d8 /dev/ashmem/dalvik-heap (deleted)
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa954 40863fbd /system/lib/libdvm.so
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa958 df0027ad
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa95c 00000000
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ #00 5fbfa960 00001000
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa964 6c756e28
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa968 0000296c
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa96c 00000000
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa970 00000000
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa974 00000000
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa978 00000000
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa97c 00000000
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa980 00000000
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa984 00000000
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa988 00000000
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa98c 00000000
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa990 00000000
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa994 00000000
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa998 00000000
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfa99c 00000000
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ ........ ........
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ #01 5fbfab78 4276f3d8 /dev/ashmem/dalvik-heap (deleted)
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfab7c 00000000
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfab80 40863e21 /system/lib/libdvm.so
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfab84 40863e41 /system/lib/libdvm.so
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ #02 5fbfab88 58909098
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfab8c 58904728
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfab90 00000000
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfab94 5fbfabe4
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfab98 58909098
12-12 13:45:35.664 16476-16476/? I/DEBUG﹕ 5fbfab9c 5d15ee0f /system/lib/libwebcore.so
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ memory near r4:
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 408c3188 00000000 00000000 00000000 00000000 ................
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 408c3198 00000000 00000000 00000000 00000000 ................
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 408c31a8 413c0e58 40eb4690 00800000 10000000 X.<A.F.@........
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 408c31b8 04000000 00004000 00006000 00000001 .....@...`......
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 408c31c8 00000101 00000002 00000001 00000000 ................
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ memory near r6:
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 4276f3b8 00650077 006b0062 00740069 00000013 w.e.b.k.i.t.....
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 4276f3c8 420a7f98 00000000 00000000 00000023 ...B........#...
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 4276f3d8 41549c30 00000000 4276f3d8 4276f3f8 0.TA......vB..vB
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 4276f3e8 4276f4f0 00000000 4276f4d8 00000023 ..vB......vB#...
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 4276f3f8 415480b8 00000000 4276f418 48c14184 ..TA......vB.A.H
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ memory near r7:
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 40863f9c bdf0b005 46294630 f01f463a 4604fd53 ....0F)F:F..S..F
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 40863fac d1f12800 bf00e7e3 0005ab70 000449f3 .(......p....I..
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 40863fbc 41ffe92d 460c4607 4639a803 4615461e -..A.F.F..9F.F.F
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 40863fcc ff82f7fd 98034621 ff7af7fe 46046ac3 ....!F....z..j.F
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 40863fdc d0322b07 f8c6f01f b3384680 f8d8e02d .+2......F8.-...
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ memory near r8:
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 4276f3b8 00650077 006b0062 00740069 00000013 w.e.b.k.i.t.....
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 4276f3c8 420a7f98 00000000 00000000 00000023 ...B........#...
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 4276f3d8 41549c30 00000000 4276f3d8 4276f3f8 0.TA......vB..vB
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 4276f3e8 4276f4f0 00000000 4276f4d8 00000023 ..vB......vB#...
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 4276f3f8 415480b8 00000000 4276f418 48c14184 ..TA......vB.A.H
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ memory near r9:
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 40069a4c 00000000 00000000 00000000 00000000 ................
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 40069a5c 00000000 00000000 00000000 00000000 ................
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 40069a6c 87780b8c 00000000 00000000 00000000 ..x.............
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 40069a7c 00000000 00000000 00000000 00000000 ................
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 40069a8c 00000000 00000000 00000000 00000000 ................
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ memory near sl:
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 58904718 00000026 41414db0 00000027 00000453 &....MAA'...S...
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 58904728 59927320 58a92c80 57b81e10 40ceb000 s.Y.,.X...W...@
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 58904738 4276f3c8 00000007 5fbfada8 00000000 ..vB......._....
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 58904748 5fbfaddc 0000000f 00010008 4083bf00 ..._...........@
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 58904758 00000000 00000000 56d0b770 58a8f300 ........p..V...X
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ memory near fp:
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 5fbfac64 58904728 00000000 40836eb4 58a92c80 (G.X.....n.@.,.X
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 5fbfac74 00000001 420a7f98 00000008 00000000 .......B........
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 5fbfac84 40866107 58a92c80 59b53045 5d1594d3 .a.@.,.XE0.Y...]
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 5fbfac94 58904738 20100001 00000000 40062544 8G.X... ....D%.@
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 5fbfaca4 40069a6c 00001000 40db4728 00000000 l..@....(G.@....
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ memory near ip:
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 00003fe0 ffffffff ffffffff ffffffff ffffffff ................
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 00003ff0 ffffffff ffffffff ffffffff ffffffff ................
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 00004000 ffffffff ffffffff ffffffff ffffffff ................
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 00004010 ffffffff ffffffff ffffffff ffffffff ................
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 00004020 ffffffff ffffffff ffffffff ffffffff ................
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ memory near sp:
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 5fbfa940 00000000 40034c65 408c31a8 0000020c ....eL.@.1.@....
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 5fbfa950 4276f3d8 40863fbd df0027ad 00000000 ..vB.?.@.'......
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 5fbfa960 00001000 6c756e28 0000296c 00000000 ....(null)......
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 5fbfa970 00000000 00000000 00000000 00000000 ................
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 5fbfa980 00000000 00000000 00000000 00000000 ................
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ code around pc:
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 4085ee30 34bcf8d3 ecbaf7d7 461d2300 b1525d1a ...4.....#.F.]R.
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 4085ee40 18ad3301 7f00f5b3 e004d1f8 4a0a4798 .3...........G.J
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 4085ee50 f7d77015 490cecb2 4a0c2006 44794c0c .p.....I. .J.LyD
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 4085ee60 447c447a eb64f7d7 f7d72000 6ca3ec0a zD|D..d.. .....l
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 4085ee70 d1eb2b00 bf00e7eb deadd00d 0005fcf8 .+..............
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ code around lr:
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 40033c74 447e4e08 68336836 f000b10b 4620fa4c .N~D6h3h....L. F
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 40033c84 ffcaf7ff 68304605 4620b110 fa50f000 .....F0h.. F..P.
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 40033c94 bd704628 0002982e 4604b570 4811b928 (Fp.....p..F(..H
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 40033ca4 e8bd4478 f0004070 4e0fbfcb 6836447e xD..p@.....N~D6h
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ 40033cb4 b10b6833 fa2ff000 f01089a0 d1060f18 3h..../.........
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ memory map around fault addr deadd00d:
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ bef50000-bef71000 [stack]
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ (no map for address)
12-12 13:45:35.669 16476-16476/? I/DEBUG﹕ ffff0000-ffff1000 [vectors]
12-12 13:45:35.774 16476-16476/? I/DEBUG﹕ !@dumpstate -k -t -z -d -o /data/log/dumpstate_app_native -m 1551
12-12 13:45:35.774 2383-2632/? I/BootReceiver﹕ Copying /data/tombstones/tombstone_01 to DropBox (SYSTEM_TOMBSTONE)
12-12 13:45:35.784 2919-2919/? I/dumpstate﹕ begin
回答1:
I fixed this by adding the following code to my custom Application
subclass:
@Override
protected void onCreate() {
super.onCreate();
CookieSyncManager.createInstance(this);
}
According to the documentation on CookieManager.getInstance():
If this method is used before the application instantiates a WebView instance, CookieSyncManager.createInstance(Context) must be called first.
In my case, I didn't instantiate a WebView
instance first, so this was the cause of my crash. Too bad they couldn't throw an Exception
instead of crashing in native code.
来源:https://stackoverflow.com/questions/20552997/cookiemanager-removeexpiredcookie-crashes-on-android-4-1-2