我有一个我已经工作了一段时间的应用程序。它使用Google的appcompat Action Bar和Spinner导航,上周工作正常。
今天,当我调用setNavigationMode(ActionBar.NAVIGATION_MODE_LIST)时,我重新编译并且应用程序崩溃。
在logcat中,我看到了一个SIGSEGV错误。
我已经能够通过使用ActionBar创建一个新的Android Studio项目来重现这个问题,ActionBar是一个带有Action bar微调器导航的空白活动,除了Android Studio生成的代码之外什么也没有。
我尝试过使用以下组件:
- Windows 8.1下的Android Studio 0.50.0
- OSX Mavericks下的Android Studio 0.5.2
- 实际的Android 2.3.4硬件
- Windows下的Android 2.2仿真器
- OS X下的Android 2.2仿真器。
编译器/平台的所有组合都存在问题。
我一直在尝试在build.gradle中指定appcompat的特定版本。但是,无论我是否使用compile&com; android.support:appcompat-v7:19.0.1'或者编译com.android.support:appcompat-v7:19.0.0'
有没有人知道这里会发生什么?
在Windows下运行的logcat和模拟器的输出:
I/dalvikvm( 370): Could not find method android.content.pm.PackageManager.getActivityLogo, referenced from method android.support.v7.internal.widget.ActionBarView.<init>
W/dalvikvm( 370): VFY: unable to resolve virtual method 312: Landroid/content/pm/PackageManager;.getActivityLogo (Landroid/content/ComponentName;)Landroid/graphics/drawable/Drawable;
D/dalvikvm( 370): VFY: replacing opcode 0x6e at 0x008b
I/dalvikvm( 370): Could not find method android.content.pm.ApplicationInfo.loadLogo, referenced from method android.support.v7.internal.widget.ActionBarView.<init>
W/dalvikvm( 370): VFY: unable to resolve virtual method 308: Landroid/content/pm/ApplicationInfo;.loadLogo (Landroid/content/pm/PackageManager;)Landroid/graphics/drawable/Drawable;
D/dalvikvm( 370): VFY: replacing opcode 0x6e at 0x0099
D/dalvikvm( 370): VFY: dead code 0x008e-0092 in Landroid/support/v7/internal/widget/ActionBarView;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;)V
D/dalvikvm( 370): VFY: dead code 0x009c-00a0 in Landroid/support/v7/internal/widget/ActionBarView;.<init> (Landroid/content/Context;Landroid/util/AttributeSet;)V
I/DEBUG ( 31): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 31): Build fingerprint: 'generic/sdk/generic/:2.2/FRF91/43546:eng/test-keys'
I/DEBUG ( 31): pid: 370, tid: 370 >>> com.example.actionbartest.app <<<
I/DEBUG ( 31): signal 11 (SIGSEGV), fault addr 00000002
I/DEBUG ( 31): r0 00000000 r1 00000001 r2 00000001 r3 00000002
I/DEBUG ( 31): r4 becab8a4 r5 0000aa50 r6 00116400 r7 00138eb0
I/DEBUG ( 31): r8 becab914 r9 4208b814 10 4208b800 fp 00000000
I/DEBUG ( 31): ip ad36ec18 sp becab868 lr ad349dbd pc a81144da cpsr 20000030
I/DEBUG ( 31): #00 pc 000144da /system/lib/libutils.so
I/DEBUG ( 31): #01 pc 00049dba /system/lib/libandroid_runtime.so
I/DEBUG ( 31): #02 pc 00049f10 /system/lib/libandroid_runtime.so
I/DEBUG ( 31): #03 pc 00013974 /system/lib/libdvm.so
I/DEBUG ( 31):
I/DEBUG ( 31): code around pc:
I/DEBUG ( 31): a81144b8 1c264337 02364016 401c4337 1c3c0a26
I/DEBUG ( 31): a81144c8 602c4334 57042403 dbea42a1 46c0bdf0
I/DEBUG ( 31): a81144d8 56c32302 56412101 230318ca 320856c3
I/DEBUG ( 31): a81144e8 008018d0 46c04770 47706800 23006802
I/DEBUG ( 31): a81144f8 d1012a00 689b6883 47701c18 21016001
I/DEBUG ( 31):
I/DEBUG ( 31): code around lr:
I/DEBUG ( 31): ad349d9c 9a059903 990947a0 29002400 ac0fd062
I/DEBUG ( 31): ad349dac 20007b22 2a009003 6920d02a ece4f7d2
I/DEBUG ( 31): ad349dbc 23b0682a 00981c01 1c285813 90034798
I/DEBUG ( 31): ad349dcc d1012800 e7b14843 22de6828 58430091
I/DEBUG ( 31): ad349ddc 1c282200 47989903 28009005 4d3ed103
I/DEBUG ( 31):
I/DEBUG ( 31): stack:
I/DEBUG ( 31): becab828 0000aa50 [heap]
I/DEBUG ( 31): becab82c 46024df8 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
I/DEBUG ( 31): becab830 420eace8 /dev/ashmem/dalvik-LinearAlloc (deleted)
I/DEBUG ( 31): becab834 808343a3 /system/lib/libdvm.so
I/DEBUG ( 31): becab838 00000000
I/DEBUG ( 31): becab83c 8086dd88 /system/lib/libdvm.so
I/DEBUG ( 31): becab840 00000000
I/DEBUG ( 31): becab844 80886910 /system/lib/libdvm.so
I/DEBUG ( 31): becab848 8082dba5 /system/lib/libdvm.so
I/DEBUG ( 31): becab84c 46024e48 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
I/DEBUG ( 31): becab850 00138eb0 [heap]
I/DEBUG ( 31): becab854 80834309 /system/lib/libdvm.so
I/DEBUG ( 31): becab858 0000aa50 [heap]
I/DEBUG ( 31): becab85c 00116400 [heap]
I/DEBUG ( 31): becab860 df002777
I/DEBUG ( 31): becab864 e3a070ad
I/DEBUG ( 31): #01 becab868 00000000
I/DEBUG ( 31): becab86c c0000000
I/DEBUG ( 31): becab870 becab914 [stack]
I/DEBUG ( 31): becab874 00000000
I/DEBUG ( 31): becab878 ad36e0a8 /system/lib/libandroid_runtime.so
I/DEBUG ( 31): becab87c 420eace8 /dev/ashmem/dalvik-LinearAlloc (deleted)
I/DEBUG ( 31): becab880 ad374ce4 /system/lib/libandroid_runtime.so
I/DEBUG ( 31): becab884 00000001
I/DEBUG ( 31): becab888 00000001
I/DEBUG ( 31): becab88c 00000001
I/DEBUG ( 31): becab890 00000000
I/DEBUG ( 31): becab894 00121ab0 [heap]
I/DEBUG ( 31): becab898 46024dd8 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
I/DEBUG ( 31): becab89c becab8c8 [stack]
I/DEBUG ( 31): becab8a0 00000000
I/DEBUG ( 31): becab8a4 ad36dc48 /system/lib/libandroid_runtime.so
I/DEBUG ( 31): becab8a8 00000002
I/DEBUG ( 31): becab8ac 00116400 [heap]
I/DEBUG ( 31): becab8b0 00000101
I/DEBUG ( 31): becab8b4 00000000
I/DEBUG ( 31): becab8b8 00000000
I/DEBUG ( 31): becab8bc 00000000
I/DEBUG ( 31): becab8c0 46024df8 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
I/DEBUG ( 31): becab8c4 00116400 [heap]
I/DEBUG ( 31): becab8c8 ad36dd10 /system/lib/libandroid_runtime.so
I/DEBUG ( 31): becab8cc 00000001
I/DEBUG ( 31): becab8d0 0000aa50 [heap]
I/DEBUG ( 31): becab8d4 80886901 /system/lib/libdvm.so
I/DEBUG ( 31): becab8d8 ad36e0a8 /system/lib/libandroid_runtime.so
I/DEBUG ( 31): becab8dc 00000000
I/DEBUG ( 31): becab8e0 0000aa50 [heap]
I/DEBUG ( 31): becab8e4 46024dd8 /dev/ashmem/mspace/dalvik-heap/2 (deleted)
I/DEBUG ( 31): becab8e8 4208b820
I/DEBUG ( 31): becab8ec ad349f15 /system/lib/libandroid_runtime.so
D/Zygote ( 33): Process 370 terminated by signal (11)
I/ActivityManager( 71): Process com.example.actionbartest.app (pid 370) has died.
================================================== ========
在Mac上编译的硬件和应用程序的输出:
I/DEBUG ( 2267): pid: 2314, tid: 2314 >>> com.example.macabtest.app <<<
I/DEBUG ( 2267): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000001
I/DEBUG ( 2267): r0 00000000 r1 00000007 r2 fffffe84 r3 00000070
I/DEBUG ( 2267): r4 0000abd8 r5 40547590 r6 ad376684 r7 00000001
I/DEBUG ( 2267): r8 00219ef0 r9 00222178 10 00000001 fp 442ef280
I/DEBUG ( 2267): ip ad3774c8 sp beb9f3c8 lr ad3515d5 pc a8115448 cpsr 20000030
I/DEBUG ( 2267): d0 0000000000000000 d1 0000000000000000
I/DEBUG ( 2267): d2 0000000000000000 d3 0000000000000000
I/DEBUG ( 2267): d4 0000000000000000 d5 0000000000000000
I/DEBUG ( 2267): d6 0000000000000000 d7 0000000000000000
I/DEBUG ( 2267): d8 0000000000000000 d9 0000000000000000
I/DEBUG ( 2267): d10 0000000000000000 d11 0000000000000000
I/DEBUG ( 2267): d12 0000000000000000 d13 0000000000000000
I/DEBUG ( 2267): d14 0000000000000000 d15 0000000000000000
I/DEBUG ( 2267): d16 0000000000000000 d17 3ff0000000000000
I/DEBUG ( 2267): d18 42eccefa43de3400 d19 3fbc71c71c71c71c
I/DEBUG ( 2267): d20 4008000000000000 d21 3fd99a27ad32ddf5
I/DEBUG ( 2267): d22 3fd24998d6307188 d23 3fcc7288e957b53b
I/DEBUG ( 2267): d24 3fc74721cad6b0ed d25 3fc39a09d078c69f
I/DEBUG ( 2267): d26 0000000000000000 d27 0000000000000000
I/DEBUG ( 2267): d28 0000000000000000 d29 0000000000000000
I/DEBUG ( 2267): d30 0000000000000000 d31 0000000000000000
I/DEBUG ( 2267): scr 60000012
I/DEBUG ( 2267):
I/DEBUG ( 2267): #00 pc 00015448 /system/lib/libutils.so
I/DEBUG ( 2267): #01 lr ad3515d5 /system/lib/libandroid_runtime.so
I/DEBUG ( 2267):
I/DEBUG ( 2267): code around pc:
I/DEBUG ( 2267): a8115428 f4026412 ea44457f ea442405 f841221c
I/DEBUG ( 2267): a8115438 33012023 1003f990 dbea428b bf00bd30
I/DEBUG ( 2267): a8115448 2001f990 3002f990 f99018d1 f1113003
I/DEBUG ( 2267): a8115458 18d00208 47700080 47706800 b10b6803
I/DEBUG ( 2267): a8115468 e0012000 68886881 bf004770 33fff04f
I/DEBUG ( 2267):
I/DEBUG ( 2267): code around lr:
I/DEBUG ( 2267): ad3515b4 f8d24629 465a71a0 46204603 f1ba47b8
I/DEBUG ( 2267): ad3515c4 d0590f00 7030f89d 980db32f eb28f7d0
I/DEBUG ( 2267): ad3515d4 68204601 22c0f8d0 47904620 b9104607
I/DEBUG ( 2267): ad3515e4 4478484c 6821e7b4 22004620 3378f8d1
I/DEBUG ( 2267): ad3515f4 47984639 b9104682 44784847 980de7a8
I/DEBUG ( 2267):
I/DEBUG ( 2267): stack:
I/DEBUG ( 2267): beb9f388 405475e0
I/DEBUG ( 2267): beb9f38c 00000000
I/DEBUG ( 2267): beb9f390 405475e0
I/DEBUG ( 2267): beb9f394 0000ce38
I/DEBUG ( 2267): beb9f398 405475e0
I/DEBUG ( 2267): beb9f39c 8004c053 /system/lib/libdvm.so
I/DEBUG ( 2267): beb9f3a0 40547590
I/DEBUG ( 2267): beb9f3a4 442ef280
I/DEBUG ( 2267): beb9f3a8 405475e0
I/DEBUG ( 2267): beb9f3ac 8004bf39 /system/lib/libdvm.so
I/DEBUG ( 2267): beb9f3b0 0000abd8
I/DEBUG ( 2267): beb9f3b4 40547590
I/DEBUG ( 2267): beb9f3b8 ad376684
I/DEBUG ( 2267): beb9f3bc 8004bf05 /system/lib/libdvm.so
I/DEBUG ( 2267): beb9f3c0 df002777
I/DEBUG ( 2267): beb9f3c4 e3a070ad
I/DEBUG ( 2267): #00 beb9f3c8 00000001
I/DEBUG ( 2267): beb9f3cc 00000000
I/DEBUG ( 2267): beb9f3d0 beb9f410
I/DEBUG ( 2267): beb9f3d4 00000000
I/DEBUG ( 2267): beb9f3d8 00000000
I/DEBUG ( 2267): beb9f3dc 00000000
I/DEBUG ( 2267): beb9f3e0 000f0d88
I/DEBUG ( 2267): beb9f3e4 40547570
I/DEBUG ( 2267): beb9f3e8 beb9f41c
I/DEBUG ( 2267): beb9f3ec ad3760c0
I/DEBUG ( 2267): beb9f3f0 00000002
I/DEBUG ( 2267): beb9f3f4 00219ef0
I/DEBUG ( 2267): beb9f3f8 00221e01
I/DEBUG ( 2267): beb9f3fc 00000000
I/DEBUG ( 2267): beb9f400 00000000
I/DEBUG ( 2267): beb9f404 00000000
I/DEBUG ( 2267): beb9f408 40547590
I/DEBUG ( 2267): beb9f40c 00219ef0
D/Zygote ( 54): Process 2314 terminated by signal (11)
I/ActivityManager( 127): Process com.example.macabtest.app (pid 2314) has died.
答案 0 :(得分:3)
更改平移设置可解决问题
不工作:
classpath 'com.android.tools.build:gradle:0.9.+'
工作:
classpath 'com.android.tools.build:gradle:0.9.0'
另见https://code.google.com/p/android/issues/detail?id=67376
修改强>
CommonsWare的解决方案更加整洁,因为它适用于所有gradle版本:
将android.aaptOptions.useAaptPngCruncher = true
添加到build.gradle
文件