QuickBirdEng / opencv-android

Easy way to integrate OpenCv into your Android project via Gradle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error loading library on Android 10+ (cannot locate symbol "_Unwind_Resume")

Shiul93 opened this issue · comments

Hello!

We have a fork of your repository to use within our project, a educational robot called Robobo. The fork only adds a new class that allows using the library in portrait mode.

When we updated from OpenCV 4_1_0_contrib to 4_3_0_contrib an error appeared on Android 10+ devices, preventing the library from loading and causing the app to crash.

I tried several things, but I don't have experience working with the NDK and all the efforts were unsuccesful, but for what I've seen online it seems that is a problem with the linking step of the library.

Here is the crash trace:

https://gist.github.com/Shiul93/24f50bca063f1f0cef7e8a979cdf8985

This was on a Samsung S9 running android 10, but it can be replicated on AVD with Android 10.

Do you have any clue of what might be causing the error?

Thank you for all your work and have a nice day! :)

Hello!
Do you have any idea about how to approach this problem? We are delaying the release of the app until we fix this and at this point any guidance would be very helpful.

Again, thanks a lot for your work and have a good day!

commented

Hi @Shiul93

Thank you for reaching out. I will try to check it next week and get back to you. It seems like a linking issues where some symbol isn't found in opencv.

Thank you @nasirky ! I'll stay alert for you response. Also, I tried to use 4_2_0_contrib and it has the same issue. The reason to move form 4.1 to a newer version was a bug on the Aruco module that caused random crashes and it seems to be fixed on 4.2+

I am in a similar position. I am using 4_3_0_contrib, and this same issue arose for me after updating gradle from 4.0 to 4.1, and the gradle wrapper to 6.5. While using classpath "com.android.tools.build:gradle:4.0.2" and distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip , this issue does not occur. @Shiul93, I would be interested to know if downgrading to these versions resolves this particular problem for you as well.

I have been working on a solution for this for a while as well with no luck. Thanks @nasirky for your time!

Hi @critt! I tried downgrading both versions and it seems to work, at least on the AVD simulator.
Thanks a lot for your answer!

@Shiul93 No problem. I would love to figure out the root cause though so we can update these things.

@nasirky any idea what could be behind these build problems with gradle 4.1?

commented

@critt At the moment, I haven't tried it on 4.1 yet. I think I should be able to try it out next week as we are in the process of setting up an alternative for JCenter and Bintray and we are very much focused there. Thank you for your patience.

@nasirky take your time. This isn't an issue with your library, more just something I'm trying to solve myself and curious if you have any thoughts. Thanks for this project btw, it has made my life much easier and really fills an otherwise frustrating space. Appreciate you guys!

commented

@critt @Shiul93 If my assumption is correct, you are including the module directly into your project? Are you including the whole Gradle module or just include the java folder?

@nasirky I am including the whole module; I need to use the opencv Java API but I also need to provide opencv c++ dependencies to native code. I figured the .so files are required for the Java files anyways (maybe an incorrect assumption?).

commented

@critt Yes you do need those files are otherwise your program will fail when linking.

@Shiul93 @critt I downloaded the opencv_4.3.0 contrib and tried it on a sample project. Ran it on an emulator with Android 11 and it worked fine. The only difference is that I am using the latest Gradle plugin versions.

Here are some of the logs

2021-08-29 11:37:11.896 9641-9641/com.quickbirdstudios.opencvexample D/OpenCV: OpenCV loaded successfully! 2021-08-29 11:47:44.667 10225-10225/com.quickbirdstudios.opencvexample D/OpenCV: Version : 4.3.0 2021-08-29 11:47:44.668 10225-10225/com.quickbirdstudios.opencvexample D/OpenCV/StaticHelper: Trying to get library list 2021-08-29 11:47:44.671 10225-10225/com.quickbirdstudios.opencvexample E/OpenCV/StaticHelper: OpenCV error: Cannot load info library for OpenCV 2021-08-29 11:47:44.671 10225-10225/com.quickbirdstudios.opencvexample D/OpenCV/StaticHelper: Library list: "" 2021-08-29 11:47:44.671 10225-10225/com.quickbirdstudios.opencvexample D/OpenCV/StaticHelper: First attempt to load libs 2021-08-29 11:47:44.671 10225-10225/com.quickbirdstudios.opencvexample D/OpenCV/StaticHelper: Trying to init OpenCV libs 2021-08-29 11:47:44.671 10225-10225/com.quickbirdstudios.opencvexample D/OpenCV/StaticHelper: Trying to load library opencv_java4 2021-08-29 11:47:44.680 10225-10225/com.quickbirdstudios.opencvexample D/OpenCV/StaticHelper: Library opencv_java4 loaded 2021-08-29 11:47:44.680 10225-10225/com.quickbirdstudios.opencvexample D/OpenCV/StaticHelper: First attempt to load libs is OK 2021-08-29 11:47:44.705 10225-10225/com.quickbirdstudios.opencvexample I/OpenCV/StaticHelper: General configuration for OpenCV 4.3.0 ====================================

Update:

  • I am able to reproduce the issue on both 4.3.0 as well as 4.5.3. However, 4.5.2 works fine.
  • What I understood from the issue is that 4.3.0 and 4.5.3 need to be recompiled with a different flag. 4.5.3 would definitely be recompiled but 4.3.0 might not be
commented

Fixes

  1. The issue could be reproduced in 4.5.3, so we had to release a new version 4.5.3.0.
  2. The issue doesn't exist in any of the other releases.

Thank you a lot for the update @nasirky! I'll be upgrading to 4.5.3.0 in the next release of our app.

Greetings!

Luis