3

I have a problem running openCV samples project (3 - 4). Everytime that I run the program, I found the problem "Unforunately OpenCV Manager has stopped" displays in my Android emulator.

The problem occurs everytime that I call

OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback);

I followed this page http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.html

This is the Warning Message that I have

/Applications/eclipse-android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: warning: hidden symbol '__aeabi_atexit' in ./obj/local/armeabi-v7a/libgnustl_static.a(atexit_arm.o) is referenced by DSO /Applications/eclipse-android/OpenCV-2.4.3-android-sdk/sdk/native/jni/../libs/armeabi-v7a/libopencv_java.so

Logcat (from OpenCV sample4):

gralloc_goldfish, org.opencv.samples.tutorial4 Emulator without GPU emulation detected.

Note:

  1. I set java compliance level to 1.6 since I have some problem compiling OpenCV c++ file. (followed this page: 'Must Override a Superclass Method' Errors after importing a project into Eclipse)

  2. I install adb with both OpenCV_2.4.3_binary_pack_armv7a.apk and OpenCV_2.4.3_Manager_2.0_armeabi-v7a.apk

  3. I used Samsung Galaxy S as my cellphone emulator
Community
  • 1
  • 1

7 Answers7

2

I run into the same problem: hidden symbol '__aeabi_atexit' armeabi-v7a/libgnustl_static.a(atexit_arm.o) is referenced by DSO

I am using the opencv test in jni, with an application that worked before I have added it. I have tried to change the ARMv7-A machine to armeabi in the "Application.mk' I have also tried to add all the paths mentioned above to the Project -> Properties -> C/C++ General -> Path and Symbols.

It didn't work. Thanks to my team leader, I have found the solution:

in Application.mk, You need to change the APP_STL := gnustl_static to APP_STL := gnustl_shared. This is because the lib apparantly was compiled in shared instead of static. In addition, add to the loadlibrary area the lib: System.loadLibrary("gnustl_shared"); This should be done in a static area, as followed:

static {
       try{
           System.loadLibrary("gnustl_shared");
           //To do - add your static code
       }
       catch(UnsatisfiedLinkError e) {
            Log.v(TAG, "Native code library failed to load.\n" + e);
       }         
       catch(Exception e) {
            Log.v(TAG, "Exception: " + e);
       }
   }

That's it! it solved my problem... Hope it helped.

Inbal

inbaly
  • 582
  • 1
  • 6
  • 16
  • 1
    `opencv` is still using static linkage to gnustl (sure, you can recompile opencv yourself with modifications, if you are looking for adventures). The warning is gone because now you have two binaries that use different STL implementations, which is not a bit cleaner than simply ignoring the warning. – Alex Cohn Jun 16 '14 at 08:17
1

Your problem might simply be emulator itself, try to get an actually device to test on. There are a lot of things that emulator can't handle.

Arveen
  • 868
  • 6
  • 18
  • I found this in OpenCV for Android document.. "Also, please consider that Tutorial 0 and Tutorial 1 samples use Java Camera API that definitelly accessible on emulator from the Android SDK. Other samples use OpenCV Native Camera which may not work with emulator." THanks for your comment :) –  Nov 19 '12 at 09:16
1

If you use Android 4.2 than change to 4.0.3 or to 4.1. There is a bug about that: http://code.opencv.org/issues/2537

cfour
  • 11
  • 1
0

I had problems this days running the two tutorials too.

On my machine I installed OpenCV 2.4.3, Android-sdk-21 and Android-ndk-r8c, Eclipse Juno. I perform my tests on an Asus Transformer tf101g running Android 4.0.3.

When I ran the tutorials it failed with a strange ClassNotFoundException. Checking the project properties I realized that the two projects look for headers in a wrong place. Go to Project -> Properties -> C/C++ General -> Path and Symbols. Here you can see the include directories used in the jni file.

The NDKROOT environment variable was not set in my system and I had to manually set it to point to the NDK root folder.

Then I had to change the stl include from

${NDKROOT}/sources/cxx-stl/gnu-libstdc++/include

to

${NDKROOT}/sources/cxx-stl/gnu-libstdc++/4.6/include

Hope this can help.

hara
  • 3,274
  • 4
  • 37
  • 55
  • replace NDKROOT with the absolute path.. to make sure that the problem doesnt come from enviroment variables –  Nov 27 '12 at 16:27
  • Yes. I added another absolute include path but i also defined an NDKROOT environment variables cause it is used elsewhere if i'm not wrong(I don't have the code right now) and I added it in the Window preferences of Eclipse. – hara Nov 27 '12 at 17:40
  • Here is my include paths; (1) ${NDKROOT}/platforms/android-9/arch-arm/usr/include (2) ${NDKROOT}/sources/cxx-stl/gnu-libstdc++/4.6/include (3) ${NDKROOT}/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include (4) /YOUR_OPENCV_PATH/sdk/native/jni/include –  Nov 27 '12 at 23:53
  • do you name the c functions correctly, it seems like your java cannot find your lib with c function.. –  Dec 03 '12 at 13:45
0

I too struggled with this for almost 4 hours, including downgrading target to 4.0.3 but did not work. The solution was to download the latest openCV manager from google play to your device directly.

Joe Qi
  • 123
  • 1
  • 14
0

I got the same error and thought even though late,the solution might help for some in future. The error "Unforunately OpenCV Manager has stopped" pops up if its version is not supported by the android device hardware(like armeabi-v7a (ARMv7-A + NEON) or Intel x86,etc). uninstall the current Manager and install the proper one.

Johny Smith
  • 154
  • 1
  • 1
  • 7
0

Paste the following code before onCreate() Method:

static {
        System.loadLibrary("opencv_java3");
}

it worked for me.