5

我使用Javacv 代码在 Andorid 中制作了一个自定义相机。我没有包含所有 .so 文件,而只包含了我的应用程序似乎需要的那些文件。如以下屏幕截图所示:

在此处输入图像描述

它在三星 Galaxy S2、S3 和索尼爱立信 Xperia Arc 上运行良好。完全没有问题。但是当我尝试在三星 P7500 Galaxy Tab 10.1 上运行它时,它在我使用的 Javacv 代码的第一行就崩溃了,它恰好是:

yuvIplImage = IplImage.create(previewWidth, previewHeight,  IPL_DEPTH_8U, 2);

此尝试的 Logcat 输出:

07-08 13:30:13.930: I/ActivityManager(192): START {intent.toShortString} from pid 7836
07-08 13:30:14.000: I/ActivityManager(192): Start proc app.processName for activity hostingNameStr: pid=7847 uid=10001 gids={1006, 3003, 1015, 1023}
07-08 13:30:14.190: D/NvOsDebugPrintf(116): GetParameter(): 37 not supported
07-08 13:30:14.190: E/NvOmxCameraSettingsParser(116): Param type 71 not supported
07-08 13:30:14.240: W/dalvikvm(7847): VFY: unable to resolve virtual method 18783: Ljava/awt/image/BufferedImage;.getSampleModel ()Ljava/awt/image/SampleModel;
07-08 13:30:14.250: D/dalvikvm(7847): VFY: replacing opcode 0x22 at 0x0007
07-08 13:30:14.250: W/dalvikvm(7847): VFY: unable to resolve virtual method 18783: Ljava/awt/image/BufferedImage;.getSampleModel ()Ljava/awt/image/SampleModel;
07-08 13:30:14.250: D/dalvikvm(7847): VFY: replacing opcode 0x74 at 0x000f
07-08 13:30:14.250: W/dalvikvm(7847): VFY: unable to resolve instance field 5673
07-08 13:30:14.250: D/dalvikvm(7847): VFY: replacing opcode 0x22 at 0x0007
07-08 13:30:14.250: W/dalvikvm(7847): VFY: unable to resolve virtual method 18783: Ljava/awt/image/BufferedImage;.getSampleModel ()Ljava/awt/image/SampleModel;
07-08 13:30:14.250: D/dalvikvm(7847): VFY: replacing opcode 0x74 at 0x0011
07-08 13:30:14.250: W/dalvikvm(7847): VFY: unable to resolve instance field 5673
07-08 13:30:14.250: D/dalvikvm(7847): VFY: replacing opcode 0x52 at 0x007f
07-08 13:30:14.260: W/dalvikvm(7847): VFY: unable to resolve static method 18764: Ljava/awt/color/ColorSpace;.getInstance (I)Ljava/awt/color/ColorSpace;
07-08 13:30:14.260: D/dalvikvm(7847): VFY: replacing opcode 0x71 at 0x0033
07-08 13:30:14.260: D/dalvikvm(7847): VFY: replacing opcode 0x1f at 0x00b7
07-08 13:30:14.260: W/dalvikvm(7847): VFY: unable to resolve static method 18764: Ljava/awt/color/ColorSpace;.getInstance (I)Ljava/awt/color/ColorSpace;
07-08 13:30:14.260: D/dalvikvm(7847): VFY: replacing opcode 0x71 at 0x00c6
07-08 13:30:14.260: W/dalvikvm(7847): VFY: unable to resolve static method 18764: Ljava/awt/color/ColorSpace;.getInstance (I)Ljava/awt/color/ColorSpace;
07-08 13:30:14.260: D/dalvikvm(7847): VFY: replacing opcode 0x71 at 0x00de
07-08 13:30:14.260: D/dalvikvm(7847): VFY: replacing opcode 0x22 at 0x0077
07-08 13:30:14.260: D/dalvikvm(7847): DexOpt: unable to opt direct call 0x4957 at 0x2d in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;.cloneBufferedImage
07-08 13:30:14.260: D/dalvikvm(7847): DexOpt: unable to opt direct call 0x4957 at 0x18 in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;.getBufferedImage
07-08 13:30:14.260: D/dalvikvm(7847): DexOpt: unable to opt direct call 0x4958 at 0x7d in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;.getBufferedImage
07-08 13:30:14.270: D/dalvikvm(7847): DexOpt: unable to opt direct call 0x4965 at 0x167 in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;.getBufferedImage
07-08 13:30:14.270: D/dalvikvm(7847): DexOpt: unable to opt direct call 0x4966 at 0x17f in Lcom/googlecode/javacv/cpp/opencv_core$IplImage;.getBufferedImage
07-08 13:30:14.820: I/DEBUG(1925): Build fingerprint: 'samsung/GT-P7500/GT-P7500:4.0.4/IMM76D/XWLP5:user/release-keys'
07-08 13:30:14.820: I/DEBUG(1925): pid: 7847, tid: 7847  >>> com.javacv.recorder <<<
07-08 13:30:14.820: I/DEBUG(1925):  r0 5be58ce7  r1 00000008  r2 5be58ce8  r3 000270b4
07-08 13:30:14.820: I/DEBUG(1925):  r4 5be7fc00  r5 00000008  r6 00000004  r7 000040f1
07-08 13:30:14.820: I/DEBUG(1925):  ip 00000000  sp beb570e0  lr b0003a43  pc 5be58cec  cpsr 00000010
07-08 13:30:14.820: I/DEBUG(1925):  d2  46fffe0000000000  d3  46fffe00c7000000
07-08 13:30:14.820: I/DEBUG(1925):  d6  4252000000000000  d7  3eaaaaab3f800000
07-08 13:30:14.930: I/DEBUG(1925): 5be58ccc e1a00006 eb004a45 eb004b9b 0002745c  ....EJ...K..\t..
07-08 13:30:14.930: I/DEBUG(1925): 5be58cec f2c00010 e79f3003 f443078f e12fff1e  .....0....C.../.
07-08 13:30:14.930: I/DEBUG(1925): 5be58cfc 000270b4 e59f300c e79f3003 e2833008  .p...0...0...0..
07-08 13:30:14.930: I/DEBUG(1925): 5be58d0c e5803000 e12fff1e 000270a4 e12fff1e  .0..../..p..../.
07-08 13:30:14.930: I/DEBUG(1925): b0003a40 3d014790 dcf62d00 bf00bd70 4c05b510  .G.=.-..p......L
07-08 13:30:14.930: I/DEBUG(1925): b0003a50 447c2001 f00160e0 2300ffb1 f00160e3  . |D.`.....#.`..
07-08 13:30:14.930: I/DEBUG(1925): 5be46000-5be7d000 /data/data/com.javacv.recorder/lib/libtbb.so
07-08 13:30:14.930: I/DEBUG(1925): 5be7d000-5be7e000 
07-08 13:30:14.930: I/DEBUG(1925):     beb570a0  b00094f0  /system/bin/linker
07-08 13:30:14.930: I/DEBUG(1925):     beb570a4  b0009f60  /system/bin/linker
07-08 13:30:14.930: I/DEBUG(1925):     beb570a8  00000413  
07-08 13:30:14.930: I/DEBUG(1925):     beb570ac  5be52a70  /data/data/com.javacv.recorder/lib/libtbb.so
07-08 13:30:14.930: I/DEBUG(1925):     beb570b0  b0009934  /system/bin/linker
07-08 13:30:14.930: I/DEBUG(1925):     beb570b4  5be46114  /data/data/com.javacv.recorder/lib/libtbb.so
07-08 13:30:14.930: I/DEBUG(1925):     beb570b8  b001c88c  
07-08 13:30:14.930: I/DEBUG(1925):     beb570bc  b00094fc  /system/bin/linker
07-08 13:30:14.930: I/DEBUG(1925):     beb570c0  b000ebf0  
07-08 13:30:14.930: I/DEBUG(1925):     beb570c4  00000000  
07-08 13:30:14.930: I/DEBUG(1925):     beb570c8  b001b868  
07-08 13:30:14.930: I/DEBUG(1925):     beb570cc  5be81000  
07-08 13:30:14.930: I/DEBUG(1925):     beb570d0  0003f000  
07-08 13:30:14.930: I/DEBUG(1925):     beb570d4  b00040d9  /system/bin/linker
07-08 13:30:14.930: I/DEBUG(1925):     beb570d8  df0027ad  
07-08 13:30:14.930: I/DEBUG(1925):     beb570dc  00000000  
07-08 13:30:14.930: I/DEBUG(1925): #00 beb570e0  b000ebf0  
07-08 13:30:14.930: I/DEBUG(1925):     beb570e4  5be7fccc  /data/data/com.javacv.recorder/lib/libtbb.so
07-08 13:30:14.930: I/DEBUG(1925):     beb570e8  00000031  
07-08 13:30:14.930: I/DEBUG(1925):     beb570ec  b0004627  /system/bin/linker
07-08 13:30:14.930: I/DEBUG(1925):     beb570f0  00000000  
07-08 13:30:14.930: I/DEBUG(1925):     beb570f4  00000000  
07-08 13:30:14.930: I/DEBUG(1925):     beb570f8  0003f0f1  
07-08 13:30:14.930: I/DEBUG(1925):     beb570fc  b0003be7  /system/bin/linker
07-08 13:30:14.930: I/DEBUG(1925):     beb57100  b0006cbc  /system/bin/linker
07-08 13:30:14.930: I/DEBUG(1925):     beb57104  b0006bcc  /system/bin/linker
07-08 13:30:14.930: I/DEBUG(1925):     beb57108  00000000  
07-08 13:30:14.930: I/DEBUG(1925):     beb5710c  b000ebf0  
07-08 13:30:14.930: I/DEBUG(1925):     beb57110  b001b97c  
07-08 13:30:14.930: I/DEBUG(1925):     beb57114  00000031  
07-08 13:30:14.930: I/DEBUG(1925):     beb57118  000040f1  
07-08 13:30:14.930: I/DEBUG(1925):     beb5711c  b001b868  
07-08 13:30:14.930: I/DEBUG(1925):     beb57120  5be81000  
07-08 13:30:14.930: I/DEBUG(1925):     beb57124  0003f000  
07-08 13:30:16.230: I/DEBUG(1925): !@dumpstate -k -t -n -z -d -o /data/log/dumpstate_app_native -m 7847
07-08 13:30:23.850: D/Zygote(114): Process 7847 terminated by signal (4)
07-08 13:30:23.850: I/ActivityManager(192): Process app.processName (pid 7847) (adj 0) has died.

我的超级英雄“PID 7847 先生”死了:(

从这个日志我可以很容易地解释应用程序正在尝试链接到 libtbb.so 但不知道出了什么问题。

我将源代码附加到 javacv jar 但仍然没有线索。然后我删除了 jars 并在我的项目中包含了所需的 jars 代码,如下面的屏幕截图所示:

在此处输入图像描述

使用断点我发现应用程序崩溃了

com.googlecode.javacpp.Loader.loadLibrary() method's line 
              System.loadLibrary(libname);

在 logcat 输出中,我得到了几乎相似的代码,但现在我知道代码的哪一部分不起作用。

07-08 15:39:43.920: D/dalvikvm(8900): Trying to load lib /data/data/com.javacv.recorder/lib/libtbb.so 0x41362fd0
07-08 15:39:43.920: A/libc(8900): Fatal signal 4 (SIGILL) at 0x57c48cec (code=1)
07-08 15:39:44.420: I/DEBUG(1925): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
07-08 15:39:44.420: I/DEBUG(1925): Build fingerprint: 'samsung/GT-P7500/GT-P7500:4.0.4/IMM76D/XWLP5:user/release-keys'
07-08 15:39:44.420: I/DEBUG(1925): pid: 8900, tid: 8900  >>> com.javacv.recorder <<<
07-08 15:39:44.420: I/DEBUG(1925): signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 57c48cec
07-08 15:39:44.420: I/DEBUG(1925):  r0 57c48ce7  r1 00000008  r2 57c48ce8  r3 000270b4
07-08 15:39:44.420: I/DEBUG(1925):  r4 57c6fc00  r5 00000008  r6 00000004  r7 000040f1
07-08 15:39:44.420: I/DEBUG(1925):  r8 b001b868  r9 57c71000  10 0003f000  fp 57c36000
07-08 15:39:44.420: I/DEBUG(1925):  ip 00000000  sp beb570e0  lr b0003a43  pc 57c48cec  cpsr 00000010
07-08 15:39:44.420: I/DEBUG(1925):  d0  400000003eaaaaab  d1  3ff0000042c80000
07-08 15:39:44.420: I/DEBUG(1925):  d2  46fffe0000000000  d3  46fffe00c7000000
07-08 15:39:44.420: I/DEBUG(1925):  d4  0000000046fffe00  d5  0000000000000000
07-08 15:39:44.420: I/DEBUG(1925):  d6  4252000000000000  d7  3eaaaaab3f800000
07-08 15:39:44.420: I/DEBUG(1925):  d8  0000000000000000  d9  0000000000000000
07-08 15:39:44.420: I/DEBUG(1925):  d10 0000000000000000  d11 0000000000000000
07-08 15:39:44.420: I/DEBUG(1925):  d12 0000000000000000  d13 0000000000000000
07-08 15:39:44.420: I/DEBUG(1925):  d14 0000000000000000  d15 0000000000000000
07-08 15:39:44.420: I/DEBUG(1925):  scr 80000010
07-08 15:39:44.460: E/DataRouter(110): usb connection is true 
07-08 15:39:44.460: E/DataRouter(110): DSR is ON. Don't send DTR ON.
07-08 15:39:44.540: I/DEBUG(1925):          #00  pc 00012cec  /data/data/com.javacv.recorder/lib/libtbb.so
07-08 15:39:44.540: I/DEBUG(1925):          #01  lr b0003a43  /system/bin/linker
07-08 15:39:44.540: I/DEBUG(1925): code around pc:
07-08 15:39:44.540: I/DEBUG(1925): 57c48ccc e1a00006 eb004a45 eb004b9b 0002745c  ....EJ...K..\t..
07-08 15:39:44.540: I/DEBUG(1925): 57c48cdc fffffe00 fffffea8 fffffeb0 e59f300c  .............0..
07-08 15:39:44.540: I/DEBUG(1925): 57c48cec f2c00010 e79f3003 f443078f e12fff1e  .....0....C.../.
07-08 15:39:44.540: I/DEBUG(1925): 57c48cfc 000270b4 e59f300c e79f3003 e2833008  .p...0...0...0..
07-08 15:39:44.540: I/DEBUG(1925): 57c48d0c e5803000 e12fff1e 000270a4 e12fff1e  .0..../..p..../.
07-08 15:39:44.540: I/DEBUG(1925): code around lr:
07-08 15:39:44.540: I/DEBUG(1925): b0003a20 2301b90a 1e4be004 0483eb00 33fff04f  ...#..K.....O..3
07-08 15:39:44.540: I/DEBUG(1925): b0003a30 460d009e 6822e006 1e5019a4 d8001cc3  ...F.."h..P.....
07-08 15:39:44.540: I/DEBUG(1925): b0003a40 3d014790 dcf62d00 bf00bd70 4c05b510  .G.=.-..p......L
07-08 15:39:44.540: I/DEBUG(1925): b0003a50 447c2001 f00160e0 2300ffb1 f00160e3  . |D.`.....#.`..
07-08 15:39:44.540: I/DEBUG(1925): b0003a60 bd10ffad 00005aa6 4b1ab51f 22004601  .....Z.....K.F."
07-08 15:39:44.540: I/DEBUG(1925): memory map around addr 57c48cec:
07-08 15:39:44.540: I/DEBUG(1925): 57c23000-57c36000 
07-08 15:39:44.540: I/DEBUG(1925): 57c36000-57c6d000 /data/data/com.javacv.recorder/lib/libtbb.so
07-08 15:39:44.540: I/DEBUG(1925): 57c6d000-57c6e000 
07-08 15:39:44.540: I/DEBUG(1925): stack:
07-08 15:39:44.540: I/DEBUG(1925):     beb570a0  b00094f0  /system/bin/linker
07-08 15:39:44.540: I/DEBUG(1925):     beb570a4  b0009f60  /system/bin/linker
07-08 15:39:44.540: I/DEBUG(1925):     beb570a8  00000413  
07-08 15:39:44.540: I/DEBUG(1925):     beb570ac  57c42a70  /data/data/com.javacv.recorder/lib/libtbb.so
07-08 15:39:44.540: I/DEBUG(1925):     beb570b0  b0009934  /system/bin/linker
07-08 15:39:44.540: I/DEBUG(1925):     beb570b4  57c36114  /data/data/com.javacv.recorder/lib/libtbb.so
07-08 15:39:44.540: I/DEBUG(1925):     beb570b8  b001c88c  
07-08 15:39:44.540: I/DEBUG(1925):     beb570bc  b00094fc  /system/bin/linker
07-08 15:39:44.540: I/DEBUG(1925):     beb570c0  b000ebf0  
07-08 15:39:44.540: I/DEBUG(1925):     beb570c4  00000000  
07-08 15:39:44.540: I/DEBUG(1925):     beb570c8  b001b868  
07-08 15:39:44.540: I/DEBUG(1925):     beb570cc  57c71000  
07-08 15:39:44.540: I/DEBUG(1925):     beb570d0  0003f000  
07-08 15:39:44.540: I/DEBUG(1925):     beb570d4  b00040d9  /system/bin/linker
07-08 15:39:44.540: I/DEBUG(1925):     beb570d8  df0027ad  
07-08 15:39:44.540: I/DEBUG(1925):     beb570dc  00000000  
07-08 15:39:44.540: I/DEBUG(1925): #00 beb570e0  b000ebf0  
07-08 15:39:44.540: I/DEBUG(1925):     beb570e4  57c6fccc  /data/data/com.javacv.recorder/lib/libtbb.so
07-08 15:39:44.540: I/DEBUG(1925):     beb570e8  00000031  
07-08 15:39:44.540: I/DEBUG(1925):     beb570ec  b0004627  /system/bin/linker
07-08 15:39:44.540: I/DEBUG(1925):     beb570f0  00000000  
07-08 15:39:44.540: I/DEBUG(1925):     beb570f4  00000000  
07-08 15:39:44.540: I/DEBUG(1925):     beb570f8  0003f0f1  
07-08 15:39:44.540: I/DEBUG(1925):     beb570fc  b0003be7  /system/bin/linker
07-08 15:39:44.540: I/DEBUG(1925):     beb57100  b0006cbc  /system/bin/linker
07-08 15:39:44.540: I/DEBUG(1925):     beb57104  b0006bcc  /system/bin/linker
07-08 15:39:44.540: I/DEBUG(1925):     beb57108  00000000  
07-08 15:39:44.540: I/DEBUG(1925):     beb5710c  b000ebf0  
07-08 15:39:44.540: I/DEBUG(1925):     beb57110  b001b97c  
07-08 15:39:44.540: I/DEBUG(1925):     beb57114  00000031  
07-08 15:39:44.540: I/DEBUG(1925):     beb57118  000040f1  
07-08 15:39:44.540: I/DEBUG(1925):     beb5711c  b001b868  
07-08 15:39:44.540: I/DEBUG(1925):     beb57120  57c71000  
07-08 15:39:44.540: I/DEBUG(1925):     beb57124  0003f000  
07-08 15:39:45.980: I/DEBUG(1925): !@dumpstate -k -t -n -z -d -o /data/log/dumpstate_app_native -m 8900
07-08 15:39:45.980: I/BootReceiver(192): Copying /data/tombstones/tombstone_01 to DropBox (SYSTEM_TOMBSTONE)
07-08 15:39:45.990: I/dumpstate(8938): begin
07-08 15:39:54.060: I/ActivityManager(192): Process app.processName (pid 8900) (adj 0) has died.
07-08 15:39:54.070: D/Zygote(114): Process 8900 terminated by signal (4)
07-08 15:39:54.070: W/ActivityManager(192): Force removing r: app died, no saved state

对“PID 7847 先生”谋杀案的进一步调查让我发现,问题不是代码,而是我的 Galaxy Tab 芯片组是 NVIDIA TEGRA 2,这就是我的应用程序无法运行的原因。

崩溃日志中的主线如下所示:

 signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 57c48cec

关于SIGILL 的介绍在这里以及相关问题相关文章

到目前为止,它似乎是 armeabi-v7a 和 armeabi 之间的问题。现在我有一个 MCQ:请让我知道以下哪个问题是我提出的正确问题,并解释其答案。

1)如果我在使用 Javacv 时错过或忽略了一些东西?

2)或者如果Javacv根本不兼容Tegra 2并且没有希望?

3)或者应该用一些额外的设置(armeabi-v7a和armeabi)编译.SO文件,这将使它与Tegra 2兼容,在这种情况下我该怎么做?

4) 我应该怎么做才能在 Galaxy P7500 10.1 Android Tab 等 Tegra 2 芯片组设备上运行它?

我的设备的 build.prop 文件:

# begin build properties
# autogenerated by buildinfo.sh
ro.build.id=IMM76D
ro.build.display.id=IMM76D.XWLP5
ro.build.version.incremental=XWLP5
ro.build.version.sdk=15
ro.build.version.codename=REL
ro.build.version.release=4.0.4
ro.build.date=Fri Aug  3 20:31:10 KST 2012
ro.build.date.utc=1343993470
ro.build.type=user
ro.build.user=dpi
ro.build.host=DELL162
ro.build.tags=release-keys
ro.product.model=GT-P7500
ro.product.name=GT-P7500
ro.product.device=GT-P7500
ro.product.brand=samsung
ro.product.board=GT-P7500
ro.product.cpu.abi=armeabi-v7a
ro.product.cpu.abi2=armeabi
ro.product.manufacturer=samsung
ro.product.locale.language=en
ro.product.locale.region=GB
ro.wifi.channels=
ro.board.platform=tegra
# ro.build.product is obsolete; use ro.product.device
ro.build.product=GT-P7500
ro.tether.denied=false
# Do not try to parse ro.build.description or .fingerprint
ro.build.description=GT-P7500-user 4.0.4 IMM76D XWLP5 release-keys
ro.build.fingerprint=samsung/GT-P7500/GT-P7500:4.0.4/IMM76D/XWLP5:user/release-keys
ro.build.characteristics=tablet,nosdcard
# Samsung Specific Properties
ro.build.PDA=P7500XWLP5
ro.build.hidden_ver=P7500XWLP5
ro.build.changelist=997989
# end build properties
ro.opengles.version = 131072
wifi.interface=wlan0
ro.ethernet.interface=eth0
ro.ethernet.autoEnable=yes
rild.libpath=/system/lib/libsec-ril.so
rild.libargs=-d /dev/ttyS0

persist.sys.storage_preload=1

# Multimedia prop for Smart View
media.enable-commonsource=true

#
# ADDITIONAL_BUILD_PROPERTIES
#
dev.sfbootcomplete=0
drm.service.enable=true
dalvik.vm.heapstartsize=5m
dalvik.vm.heapgrowthlimit=64m
dalvik.vm.heapsize=256m
ro.com.google.clientidbase=android-samsung
ro.error.receiver.default=com.samsung.receiver.error
ro.url.legal=http://www.google.com/intl/%s/mobile/android/basic/phone-legal.html
ro.url.legal.android_privacy=http://www.google.com/intl/%s/mobile/android/basic/privacy.html
ro.com.google.locationfeatures=1
ro.kernel.qemu=0
drm.service.enabled=true
ro.setupwizard.mode=OPTIONAL
ro.com.google.apphider=off
ro.com.google.gmsversion=4.0_r3
dalvik.vm.dexopt-flags=m=y
net.bt.name=Android
dalvik.vm.stack-trace-file=/data/anr/traces.txt
4

1 回答 1

0

为了摆脱这个问题,我找到了另一种方法。

只需检查用户使用您的应用程序的设备是否支持自定义相机。

这样您就可以处理它并改为启动本机相机。

private void checkIsCustomCameraSupported()
    {
        int isNeon = com.javacv.recorder.Util.checkNeonFeature();
        if (isNeon == 0)
        {
            IS_CUSTOM_CAMERA_ENABLED = false;
            Toast.makeText(MainActivity.this, "Custom Camera is not supported", Toast.LENGTH_LONG).show();
        //  finish(); or intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
        }
    }

更多详情:

https://github.com/sourab-sharma/TouchToRecord/tree/master/TouchToRecordDemo

于 2014-11-07T14:37:54.780 回答