Skip to content

java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil in Marshmallow #245

Closed
@boybeak

Description

@boybeak
mFrameRecorder = new FFmpegFrameRecorder(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES).getAbsolutePath() + File.separator + "new.mp4", 480, 480, 1);

crash happened in this code after i update my nexus5 to Marshmallow,and it works fine before.And the error log below:

10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime: FATAL EXCEPTION: main
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime: Process: com.beak.petsfbi, PID: 22095
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime: java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at java.lang.Class.classForName(Native Method)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at java.lang.Class.forName(Class.java:324)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at org.bytedeco.javacpp.Loader.load(Loader.java:390)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at org.bytedeco.javacpp.Loader.load(Loader.java:358)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at org.bytedeco.javacpp.avcodec$AVPacket.<clinit>(avcodec.java:1407)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at org.bytedeco.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:149)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at com.beak.petsfbi.activity.VideoRecorderActivity.startRecord(VideoRecorderActivity.java:177)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at com.beak.petsfbi.activity.VideoRecorderActivity$1.onClick(VideoRecorderActivity.java:57)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at android.view.View.performClick(View.java:5198)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at android.view.View$PerformClick.run(View.java:21147)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at android.os.Handler.handleCallback(Handler.java:739)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:95)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:148)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:5417)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Native Method)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
10-06 16:15:28.015 22095-22095/com.beak.petsfbi E/AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Activity

phajduk

phajduk commented on Oct 6, 2015

@phajduk

+1 I have the same problem.

saudet

saudet commented on Oct 7, 2015

@saudet
Member

Did they break backward compatibility? Is there any info on that from Google?

boybeak

boybeak commented on Oct 7, 2015

@boybeak
Author

@saudet My android studio version is 1.4, compileSdkVersion 23, buildToolsVersion 23.0.0

boybeak

boybeak commented on Oct 7, 2015

@boybeak
Author

@saudet I've been tried all the solution in #133 ,but not working

boybeak

boybeak commented on Oct 7, 2015

@boybeak
Author
tomerhatav

tomerhatav commented on Oct 8, 2015

@tomerhatav

+1 I have the same problem here. :(

zavadpe

zavadpe commented on Oct 21, 2015

@zavadpe

As boybeak wrote, official release page explicitly refers to loading of shared libraries with text relocations:

On previous versions of Android, if your app requested the system to load a shared library with text relocations, the system displayed a warning but still allowed the library to be loaded. Beginning in this release, the system rejects this library if your app's target SDK version is 23 or higher.

saudet

saudet commented on Oct 21, 2015

@saudet
Member

@zavadpe If you know what we need to do for that, please update the instructions on this wiki page: https://github.com/bytedeco/javacpp-presets/wiki/Build-Environments

zavadpe

zavadpe commented on Oct 21, 2015

@zavadpe

I did only simple workaround for now as suggested in the text I quoted - I decreased target SDK to 22 in my project.
Long term solution requires ffmpeg libraries (I saw avutil causing an error) to be built without text relocations but I have no experience how to do that. But developer site suggests to go here where good instructions can be found how to find those textrels. However I may take look at it later.

ryango

ryango commented on Nov 2, 2015

@ryango

What version of ffmpeg is being used in the binary distro of javacv? According to
http://stackoverflow.com/questions/32346402/libavcodec-so-has-text-relocations there are 2 commits that change how android is built
FFmpeg/FFmpeg@f963f80
FFmpeg/FFmpeg@cb416a7
Looks like they have been around since 2.6?

ryango

ryango commented on Nov 5, 2015

@ryango

Actually not since 2.6. Seems like it's only in unreleased master. Pulling latest Ffmpeg master and compiling with ndk-r10e in checking avcodec.so. Looks like it'll be with 2.9 when they gm that release. Having linker issues now with the jni when I just swap out the .so files (expected). I guess I have to build javacv, javacpp and ffmpeg from scratch.

ryango

ryango commented on Nov 5, 2015

@ryango

Haha I'm just going to keep spamming here, apologies. Looks like has been in since 2.6. Verified building with r10e and 2.8 release HEAD I get no text relocations in avcodec. Same linker issue with the jni. Will try to rebuild all the deps, though you should consider pulling latest ffmpeg if you haven't and building the android libs before everyone who uses javacv in android comes calling.

49 remaining items

pedroSG94

pedroSG94 commented on May 13, 2016

@pedroSG94

I tried with those binaries and know crash with this error:

A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 16167

Only a line no more log.
According this post:
https://hub.jmonkeyengine.org/t/adnroid-project-fails-with-a-libc-fatal-signal-11-sigsegv-code-2-fault-addr-0x40a00000-in-tid-21434-gcdaemon/34034/3

Native libc tries to access invalid address

pedroSG94

pedroSG94 commented on May 13, 2016

@pedroSG94

more log for my error:

05-13 12:04:22.199 20760-20760/com.example.pedro.ffmpeg30 A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 20760 (.pedro.ffmpeg30)
05-13 12:04:22.307 371-371/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
05-13 12:04:22.313 371-371/? A/DEBUG: Build fingerprint: 'google/shamu/shamu:6.0.1/MMB29K/2419427:user/release-keys'
05-13 12:04:22.314 371-371/? A/DEBUG: Revision: '0'
05-13 12:04:22.314 371-371/? A/DEBUG: ABI: 'arm'
05-13 12:04:22.316 371-371/? A/DEBUG: pid: 20760, tid: 20760, name: .pedro.ffmpeg30  >>> com.example.pedro.ffmpeg30 <<<
05-13 12:04:22.316 371-371/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
05-13 12:04:22.319 371-371/? W/debuggerd: type=1400 audit(0.0:145): avc: denied { search } for name="com.example.pedro.ffmpeg30" dev="dm-1" ino=539446 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
05-13 12:04:22.343 371-371/? A/DEBUG:     r0 00000000  r1 00000002  r2 b684b031  r3 b3a53e7c
05-13 12:04:22.343 371-371/? A/DEBUG:     r4 b3a4f594  r5 b67fba61  r6 ab482d04  r7 00000001
05-13 12:04:22.343 371-371/? A/DEBUG:     r8 b6f866ec  r9 0000000b  sl ab482d04  fp b6f7f2fc
05-13 12:04:22.343 371-371/? A/DEBUG:     ip fffffe8c  sp becaf850  lr b39f2ec1  pc b39f458a  cpsr 000d0030
05-13 12:04:22.329 371-371/? W/debuggerd: type=1400 audit(0.0:146): avc: denied { search } for name="com.example.pedro.ffmpeg30" dev="dm-1" ino=539446 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
05-13 12:04:22.364 371-371/? A/DEBUG:     #00 pc 0001a58a  /data/data/com.example.pedro.ffmpeg30/cache/javacpp13478039802826/libc.so
05-13 12:04:22.364 371-371/? A/DEBUG:     #01 pc 00016695  /data/data/com.example.pedro.ffmpeg30/cache/javacpp13478039802826/libc.so
05-13 12:04:22.364 371-371/? A/DEBUG:     #02 pc 00002465  /system/bin/linker (__dl__ZN6soinfo13call_functionEPKcPFvvE+48)
05-13 12:04:22.365 371-371/? A/DEBUG:     #03 pc 0000252f  /system/bin/linker (__dl__ZN6soinfo10call_arrayEPKcPPFvvEjb+134)
05-13 12:04:22.365 371-371/? A/DEBUG:     #04 pc 000026f5  /system/bin/linker (__dl__ZN6soinfo17call_constructorsEv+160)
05-13 12:04:22.365 371-371/? A/DEBUG:     #05 pc 00006115  /system/bin/linker (__dl__Z9do_dlopenPKciPK17android_dlextinfo+224)
05-13 12:04:22.365 371-371/? A/DEBUG:     #06 pc 00001c95  /system/bin/linker (__dl_dlopen+20)
05-13 12:04:22.365 371-371/? A/DEBUG:     #07 pc 0025b13b  /system/lib/libart.so (art::JavaVMExt::LoadNativeLibrary(_JNIEnv*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, _jobject*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)+650)
05-13 12:04:22.369 371-371/? A/DEBUG:     #08 pc 002d13d7  /system/lib/libart.so (art::Runtime_nativeLoad(_JNIEnv*, _jclass*, _jstring*, _jobject*, _jstring*)+194)
05-13 12:04:22.370 371-371/? A/DEBUG:     #09 pc 738b0105  /data/dalvik-cache/arm/system@framework@boot.oat (offset 0x1ec9000)
05-13 12:04:22.359 371-371/? W/debuggerd: type=1400 audit(0.0:147): avc: denied { search } for name="com.example.pedro.ffmpeg30" dev="dm-1" ino=539446 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
05-13 12:04:22.668 371-371/? E/DEBUG: AM write failed: Broken pipe
05-13 12:04:22.669 863-879/? I/BootReceiver: Copying /data/tombstones/tombstone_06 to DropBox (SYSTEM_TOMBSTONE)
05-13 12:04:22.679 863-20795/? W/ActivityManager:   Force finishing activity com.example.pedro.ffmpeg30/.MainActivity
05-13 12:04:22.717 863-20795/? E/JavaBinder: !!! FAILED BINDER TRANSACTION !!!  (parcel size = 104)
05-13 12:04:22.719 863-20795/? W/ActivityManager: Exception thrown during pause
                                                  android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died
                                                      at android.os.BinderProxy.transactNative(Native Method)
                                                      at android.os.BinderProxy.transact(Binder.java:503)
                                                      at android.app.ApplicationThreadProxy.schedulePauseActivity(ApplicationThreadNative.java:727)
                                                      at com.android.server.am.ActivityStack.startPausingLocked(ActivityStack.java:867)
                                                      at com.android.server.am.ActivityStack.finishActivityLocked(ActivityStack.java:2907)
                                                      at com.android.server.am.ActivityStack.finishTopRunningActivityLocked(ActivityStack.java:2763)
                                                      at com.android.server.am.ActivityStackSupervisor.finishTopRunningActivityLocked(ActivityStackSupervisor.java:2760)
                                                      at com.android.server.am.ActivityManagerService.handleAppCrashLocked(ActivityManagerService.java:12037)
                                                      at com.android.server.am.ActivityManagerService.makeAppCrashingLocked(ActivityManagerService.java:11933)
                                                      at com.android.server.am.ActivityManagerService.crashApplication(ActivityManagerService.java:12622)
                                                      at com.android.server.am.ActivityManagerService.handleApplicationCrashInner(ActivityManagerService.java:12129)
                                                      at com.android.server.am.NativeCrashListener$NativeCrashReporter.run(NativeCrashListener.java:86)
05-13 12:04:22.735 275-275/? E/lowmemorykiller: Error writing /proc/20760/oom_score_adj; errno=22
05-13 12:04:22.776 863-5760/? I/OpenGLRenderer: Initialized EGL, version 1.4
05-13 12:04:22.799 387-387/? I/Zygote: Process 20760 exited due to signal (11)
05-13 12:04:22.800 863-1693/? I/ActivityManager: Process com.example.pedro.ffmpeg30 (pid 20760) has died
05-13 12:04:22.827 4337-4337/? I/MicroDetectionWorker: Micro detection mode: [mDetectionMode: [1]].
05-13 12:04:22.841 4337-20799/? I/MicroRecognitionRunner: Starting detection.
05-13 12:04:22.841 4337-18339/? I/MicrophoneInputStream: mic_starting com.google.android.apps.gsa.speech.audio.ah@a5e2527
05-13 12:04:22.845 374-20802/? I/AudioFlinger: AudioFlinger's thread 0xb28c0000 ready to run
05-13 12:04:22.846 374-1270/? I/SoundTriggerHwService::Module: void android::SoundTriggerHwService::Module::onCallbackEvent(const android::sp<android::SoundTriggerHwService::CallbackEvent>&) mClient == 0
05-13 12:04:22.847 4337-18339/? I/MicrophoneInputStream: mic_started com.google.android.apps.gsa.speech.audio.ah@a5e2527
05-13 12:04:22.857 374-20802/? D/audio_hw_primary: select_devices: out_snd_device(0: none) in_snd_device(61: voice-rec-mic)
05-13 12:04:22.857 374-20802/? D/msm8974_platform: platform_send_audio_calibration: sending audio calibration for snd_device(61) acdb_id(62)
05-13 12:04:22.857 374-20802/? D/audio_hw_primary: enable_snd_device: snd_device(61: voice-rec-mic)
05-13 12:04:22.861 374-20802/? D/audio_hw_primary: enable_audio_route: apply and update mixer path: audio-record
05-13 12:04:22.871 4337-20800/? I/DeviceStateChecker: DeviceStateChecker cancelled
05-13 12:04:22.874 4337-4337/? I/MicroDetector: Keeping mic open: false
05-13 12:04:22.874 4337-4337/? I/MicrophoneInputStream: mic_close com.google.android.apps.gsa.speech.audio.ah@a5e2527
05-13 12:04:22.875 4337-18339/? E/AudioRecord-JNI: Error -4 during AudioRecord native read
05-13 12:04:22.989 374-20802/? D/audio_hw_primary: disable_audio_route: reset and update mixer path: audio-record
05-13 12:04:22.991 374-20802/? D/audio_hw_primary: disable_snd_device: snd_device(61: voice-rec-mic)
05-13 12:04:22.996 374-1270/? I/SoundTriggerHwService::Module: void android::SoundTriggerHwService::Module::onCallbackEvent(const android::sp<android::SoundTriggerHwService::CallbackEvent>&) mClient == 0
05-13 12:04:22.998 4337-20799/? I/MicroRecognitionRunner: Detection finished
05-13 12:04:22.999 4337-4688/? I/MicroRecognitionRunner: Stopping hotword detection.
05-13 12:04:23.384 1751-1935/? W/OpenGLRenderer: Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer...
05-13 12:04:26.936 863-1325/? D/WifiStateMachine: starting scan for "Droiders-dev"WPA_PSK with 5240,2462,2437
05-13 12:04:33.311 863-875/? I/UsageStatsService: User[0] Flushing usage stats to disk
05-13 12:04:40.319 863-2032/? D/NetlinkSocketObserver: NeighborEvent{elapsedMs=13496201, 192.168.2.1, [A0481CB8D7BD], RTM_NEWNEIGH, NUD_PROBE}
05-13 12:04:46.939 863-1325/? D/WifiStateMachine: starting scan for "Droiders-dev"WPA_PSK with 5240,2462,2437
05-13 12:04:58.191 863-2032/? D/NetlinkSocketObserver: NeighborEvent{elapsedMs=13514072, 192.168.2.1, [A0481CB8D7BD], RTM_NEWNEIGH, NUD_STALE}
saudet

saudet commented on May 13, 2016

@saudet
Member

@pedroSG94 It looks like you're hitting bug #133. Please follow the workaround, or if you don't like it, please report the problem upstream to Google. If you don't complain, they will not listen.

saudet

saudet commented on May 16, 2016

@saudet
Member

Yes, version 1.2 has been released. Please use that version:
http://search.maven.org/#search|ga|1|bytedeco

saudet

saudet commented on May 16, 2016

@saudet
Member

And thanks to you all for helping me debug this!!

jsichi

jsichi commented on Jun 12, 2016

@jsichi
Contributor

@pedroSG94 : I hit the same sigsegv stack as you. To fix it, besides upgrading to 1.2, I also needed to use 1.2.1 for the version of the javacpp artifact (even though all of the other artifacts are currently at 1.2.

So in my build.sbt:

libraryDependencies ++= Seq(
  "org.bytedeco"                 % "javacpp"         % "1.2.1",
  "org.bytedeco"                 % "javacv"          % "1.2",
  "org.bytedeco.javacpp-presets" % "opencv" % "3.1.0-1.2" classifier "",
  "org.bytedeco.javacpp-presets" % "opencv" % "3.1.0-1.2" classifier "android-arm",
  "org.bytedeco.javacpp-presets" % "ffmpeg" % "3.0.2-1.2" classifier "",
  "org.bytedeco.javacpp-presets" % "ffmpeg" % "3.0.2-1.2") classifier "android-arm"
)
praveen-kanwar

praveen-kanwar commented on Jun 7, 2017

@praveen-kanwar

In gradle simply put this lines

compile(group: 'org.bytedeco', name: 'javacv-platform', version: '1.3'){
exclude group: 'org.bytedeco.javacpp-presets'
}
compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '3.2.1-1.3'
compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '3.2.1-1.3', classifier: 'android-arm'
monxarat

monxarat commented on Aug 1, 2017

@monxarat

@praveen-kanwar Thank you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jsichi@alexbatashev@ryango@ongakuer@praveen-kanwar

        Issue actions

          java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil in Marshmallow · Issue #245 · bytedeco/javacv