Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal UnsatisfiedLinkError Crash on 4.1 & 4.2 Devices #256

Closed
jpribble opened this issue Nov 22, 2017 · 12 comments
Closed

Fatal UnsatisfiedLinkError Crash on 4.1 & 4.2 Devices #256

jpribble opened this issue Nov 22, 2017 · 12 comments

Comments

@jpribble
Copy link

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Huawei Prism II: Android 4.1.1
HTC One X+: Android 4.2.2

Steps to Reproduce

  1. Launch the CameraKit demo app (v0.12.1) on a 4.1/4.2 device.
  2. Take a picture.

Expected Behavior

Picture should be captured without crashing.

Actual Behavior

Demo app crashed due to a fatal, uncaught UnsatisfiedLinkError.

Huawei Prism II: Android 4.1.1:

UnsatisfiedLinkError: Cannot load library: link_image[1893]: 132 could not load needed library 'libJniYuvOperator.so' for 'libJniBitmapOperator.so' (load_library[1095]: Library 'libJniYuvOperator.so' not found)
at java.lang.Runtime.loadLibrary(Runtime.java:375)
at java.lang.System.loadLibrary(System.java:535)
at com.wonderkiln.camerakit.BitmapOperator.(BitmapOperator.java:81)
at com.wonderkiln.camerakit.PostProcessor.getJpeg(PostProcessor.java:50) 
at com.wonderkiln.camerakit.CameraView$5.imageCaptured(CameraView.java:439) 
at com.wonderkiln.camerakit.Camera1$2.onPictureTaken(Camera1.java:288) 
at android.hardware.Camera$EventHandler.handleMessage(Camera.java:757) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:137) 
at android.os.HandlerThread.run(HandlerThread.java:60) 

HTC One X+: Android 4.2.2:

UnsatisfiedLinkError: Cannot load library: soinfo_link_image(linker.cpp:1635): could not load library "libJniYuvOperator.so" needed by "libJniBitmapOperator.so"; caused by load_library(linker.cpp:745): library "libJniYuvOperator.so" not found
at java.lang.Runtime.loadLibrary(Runtime.java:371)
at java.lang.System.loadLibrary(System.java:535)
at com.wonderkiln.camerakit.BitmapOperator.(BitmapOperator.java:81)
at com.wonderkiln.camerakit.PostProcessor.getJpeg(PostProcessor.java:50) 
at com.wonderkiln.camerakit.CameraView$5.imageCaptured(CameraView.java:439) 
at com.wonderkiln.camerakit.Camera1$2.onPictureTaken(Camera1.java:288) 
at android.hardware.Camera$EventHandler.handleMessage(Camera.java:792) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:158) 
at android.os.HandlerThread.run(HandlerThread.java:60) 

@browningweb
Copy link

I have this problem on android 4.2.2.

@4brunu
Copy link
Contributor

4brunu commented Dec 12, 2017

I submit a PR with a fix for this issue #279.
While the PR isn't merged, you can do a quick fix by adding this to your Activity or Fragment where the com.wonderkiln.camerakit.CameraView is.

    static {
        System.loadLibrary("jpge");
        System.loadLibrary("jpgd");
        System.loadLibrary("JniYuvOperator");
        System.loadLibrary("JniBitmapOperator");
    }

@dwillmc
Copy link
Member

dwillmc commented Dec 12, 2017

Thanks for your PR @4brunu , merged into next release branch. Will release today.

@4brunu
Copy link
Contributor

4brunu commented Dec 12, 2017

This was fast! thanks 👍

@udanieli
Copy link

I am testing master (47cda44) and am experiencing the UnsatisfiedLinkError. I also tried to deploy the demo apk directly to the phone, instead of using the Run function of Android Studio (suspecting some Android Studio flaw). Am I doing something wrong?

@4brunu
Copy link
Contributor

4brunu commented Jan 17, 2018

@udanieli Could show the stack strace?
Probably this is related with Replace jpgd and jpge with libjpeg-turbo

@udanieli
Copy link

udanieli commented Jan 17, 2018

Thank you for the quick reply. Stack trace is null. I only see this:
java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1891]: 25444 could not load needed library 'libyuvOperator.so' for 'libjpegTransformer.so' (load_library[1093]: Library 'libyuvOperator.so' not found)
androidstudio
here is something that seems a call stack:
androidstudio2
I tried to add --stacktrace --debug parameters to gradle cmdline. Logcat is empty, I have checked No filters option, nothing.
I am a frustrated Android newbie. I have been working for years with Java but never fell in love with it. I still have the clear feeling of not having control over things in the Java ecosystem, especially debugging seems a hard task to accomplish. Please have mercy.

@4brunu
Copy link
Contributor

4brunu commented Jan 17, 2018

Can you share a sample project showing the error?

@udanieli
Copy link

It's the demo module in library's project, at revision 47cda44 (did not touch any file).

@udanieli
Copy link

Looking to the source code and the commit you pointed me (431f59d) it seems that this fix should be done again. Just testing, I made this simple patch:

https://github.com/udanieli/camerakit-android/commit/06e55ac8825cd0e5d181bf5a79dc21e977f618ed

then the demo crashes anyway for an OutOfMemoryException thrown from here, maybe because my camera creates a really big photo. Running the demo on an emulated device (640x480) no exception, the demo runs smoothly. I think it's another story.

@4brunu
Copy link
Contributor

4brunu commented Jan 18, 2018

@udanieli Your fix looks good 👍
Yes, thats a separated issue.
Could you please submit a Pull Request with the fix?

@austinkettner
Copy link
Member

Second that, would love a PR, we can look at immediately merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants