问题
I have made a custom camera in Andorid using Javacv code. I hadn't included all the .so files but only those which seems required for my application. As in the screen shot below:
It works well on Samsumg Galaxy S2, S3 and Sony Ericsson Xperia Arc. No problem at all. But when I tried to run it on Samsung P7500 Galaxy Tab 10.1, it crashed on the very first line of Javacv code I have used which happens to be:
yuvIplImage = IplImage.create(previewWidth, previewHeight, IPL_DEPTH_8U, 2);
Logcat Ouput for this attempt:
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.
My Super Hero "Mr. PID 7847" Died :(
From this log I can easily interpret app is trying to link to libtbb.so But no clue what went wrong.
I attached source code to javacv jar but still no clue. Then I removed the jars and included code in my project with required jars, As you can see in screen shot below:
Using break points I found that app is crashing at
com.googlecode.javacpp.Loader.loadLibrary() method's line
System.loadLibrary(libname);
And in logcat output I got almost similar code but now I know which part of the code is not working.
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
Further investigation in "Mr. PID 7847" murder case has lead me to the facts that it is not the code that is at fault but in my Galaxy Tab chipset is NVIDIA TEGRA 2 and this is reason my app is not working.
The main line in crash log looks like :
signal 4 (SIGILL), code 1 (ILL_ILLOPC), fault addr 57c48cec
Intro about SIGILL is here and a Related Issue and a Related Article.
So far it seems like its a matter between armeabi-v7a and armeabi. Now I have a MCQ : Please let me know which of the following is correct question by me and explain its answer too.
1) If I have missed or neglected something until now while using Javacv ?
2) Or if Javacv is not Tegra 2 compatible at all and no hope is there ?
3) Or should .SO filesbe compiled with some additional settings (armeabi-v7a and armeabi) which will make it Tegra 2 compatible , in such case how can I do that ?
4) What Should I do to run it on Tegra 2 chipset devices like Galaxy P7500 10.1 Android Tab ?
My Device's build.prop file:
# 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
回答1:
To get rid of this problem, I have found an alternative way.
Simply check is custom camera is supported on device in which user is using your app.
So that you can handle it and start native camera instead.
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);
}
}
For further details:
https://github.com/sourab-sharma/TouchToRecord/tree/master/TouchToRecordDemo
来源:https://stackoverflow.com/questions/17525277/system-loadlibrarylibname-crashing-on-nvidia-tegra-2-chipset-android-samsung