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

Comments

Projects
None yet
6 participants
@jpribble

jpribble commented Nov 22, 2017

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

This comment has been minimized.

Show comment
Hide comment
@browningweb

browningweb Dec 3, 2017

I have this problem on android 4.2.2.

browningweb commented Dec 3, 2017

I have this problem on android 4.2.2.

@4brunu

This comment has been minimized.

Show comment
Hide comment
@4brunu

4brunu Dec 12, 2017

Contributor

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");
    }
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

This comment has been minimized.

Show comment
Hide comment
@dwillmc

dwillmc Dec 12, 2017

Member

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

Member

dwillmc commented Dec 12, 2017

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

@4brunu

This comment has been minimized.

Show comment
Hide comment
@4brunu

4brunu Dec 12, 2017

Contributor

This was fast! thanks 👍

Contributor

4brunu commented Dec 12, 2017

This was fast! thanks 👍

@udanieli

This comment has been minimized.

Show comment
Hide comment
@udanieli

udanieli Jan 17, 2018

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?

udanieli commented Jan 17, 2018

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

This comment has been minimized.

Show comment
Hide comment
@4brunu

4brunu Jan 17, 2018

Contributor

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

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

This comment has been minimized.

Show comment
Hide comment
@udanieli

udanieli 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.

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

This comment has been minimized.

Show comment
Hide comment
@4brunu

4brunu Jan 17, 2018

Contributor

Can you share a sample project showing the error?

Contributor

4brunu commented Jan 17, 2018

Can you share a sample project showing the error?

@udanieli

This comment has been minimized.

Show comment
Hide comment
@udanieli

udanieli Jan 17, 2018

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

udanieli commented Jan 17, 2018

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

udanieli added a commit to udanieli/camerakit-android that referenced this issue Jan 18, 2018

fix load deps of native libraries explicitly, CameraKit#256
because of old platforms, needed again after commit 431f59d
@udanieli

This comment has been minimized.

Show comment
Hide comment
@udanieli

udanieli Jan 18, 2018

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:

udanieli@06e55ac

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.

udanieli commented Jan 18, 2018

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:

udanieli@06e55ac

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

This comment has been minimized.

Show comment
Hide comment
@4brunu

4brunu Jan 18, 2018

Contributor

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

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

This comment has been minimized.

Show comment
Hide comment
@austinkettner

austinkettner Jan 19, 2018

Member

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

Member

austinkettner commented Jan 19, 2018

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