sawpawan / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

.so files gets deleted on Build&Run (Android) #319

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a project which uses android-ndk(in my case this was the opencv's 
sample face-detection)
2. Follow the README steps of JavaCV and set the android project
3. Build and Run the project and get the following error:

05-21 06:08:27.640: E/AndroidRuntime(5882): FATAL EXCEPTION: main
05-21 06:08:27.640: E/AndroidRuntime(5882): 
java.lang.ExceptionInInitializerError
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
org.opencv.samples.facedetect.FdActivity.onCreate(FdActivity.java:193)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
android.app.Activity.performCreate(Activity.java:5163)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2061)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
android.app.ActivityThread.access$600(ActivityThread.java:140)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
android.os.Handler.dispatchMessage(Handler.java:99)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
android.os.Looper.loop(Looper.java:137)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
android.app.ActivityThread.main(ActivityThread.java:4895)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
java.lang.reflect.Method.invokeNative(Native Method)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
java.lang.reflect.Method.invoke(Method.java:511)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
dalvik.system.NativeStart.main(Native Method)
05-21 06:08:27.640: E/AndroidRuntime(5882): Caused by: 
java.lang.ExceptionInInitializerError
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
java.lang.Class.classForName(Native Method)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
java.lang.Class.forName(Class.java:217)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
com.googlecode.javacpp.Loader.load(Loader.java:453)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
com.googlecode.javacv.cpp.opencv_contrib.<clinit>(opencv_contrib.java:104)
05-21 06:08:27.640: E/AndroidRuntime(5882):     ... 15 more
05-21 06:08:27.640: E/AndroidRuntime(5882): Caused by: 
java.lang.ExceptionInInitializerError
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
java.lang.Class.classForName(Native Method)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
java.lang.Class.forName(Class.java:217)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
com.googlecode.javacpp.Loader.load(Loader.java:453)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
com.googlecode.javacv.cpp.opencv_calib3d.<clinit>(opencv_calib3d.java:94)
05-21 06:08:27.640: E/AndroidRuntime(5882):     ... 19 more
05-21 06:08:27.640: E/AndroidRuntime(5882): Caused by: 
java.lang.ExceptionInInitializerError
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
java.lang.Class.classForName(Native Method)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
java.lang.Class.forName(Class.java:217)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
com.googlecode.javacpp.Loader.load(Loader.java:453)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
com.googlecode.javacv.cpp.opencv_highgui.<clinit>(opencv_highgui.java:85)
05-21 06:08:27.640: E/AndroidRuntime(5882):     ... 23 more
05-21 06:08:27.640: E/AndroidRuntime(5882): Caused by: 
java.lang.ExceptionInInitializerError
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
java.lang.Class.classForName(Native Method)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
java.lang.Class.forName(Class.java:217)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
com.googlecode.javacpp.Loader.load(Loader.java:453)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
com.googlecode.javacv.cpp.opencv_imgproc.<clinit>(opencv_imgproc.java:97)
05-21 06:08:27.640: E/AndroidRuntime(5882):     ... 27 more
05-21 06:08:27.640: E/AndroidRuntime(5882): Caused by: 
java.lang.UnsatisfiedLinkError: Couldn't load jniopencv_core: findLibrary 
returned null
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
java.lang.Runtime.loadLibrary(Runtime.java:365)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
java.lang.System.loadLibrary(System.java:535)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
com.googlecode.javacpp.Loader.loadLibrary(Loader.java:593)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
com.googlecode.javacpp.Loader.load(Loader.java:489)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
com.googlecode.javacpp.Loader.load(Loader.java:431)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:136)
05-21 06:08:27.640: E/AndroidRuntime(5882):     ... 31 more
05-21 06:08:27.640: E/AndroidRuntime(5882): Caused by: 
java.lang.UnsatisfiedLinkError: Couldn't load opencv_core: findLibrary returned 
null
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
java.lang.Runtime.loadLibrary(Runtime.java:365)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
java.lang.System.loadLibrary(System.java:535)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
com.googlecode.javacpp.Loader.loadLibrary(Loader.java:593)
05-21 06:08:27.640: E/AndroidRuntime(5882):     at 
com.googlecode.javacpp.Loader.load(Loader.java:481)
05-21 06:08:27.640: E/AndroidRuntime(5882):     ... 33 more

After some investigation i saw that whenever i build and run the project, it 
deletes all the *.so files under armeabi thus being the reason for getting 
unsatisfiedLinkError.

How may i fix this? i already recreated project and reinstalled 
javacv/opencv/ndk/adt twice.

Original issue reported on code.google.com by cihancam...@gmail.com on 21 May 2013 at 3:21

GoogleCodeExporter commented 8 years ago
Is this by any chance related to issue #199?

Original comment by samuel.a...@gmail.com on 21 May 2013 at 12:42

GoogleCodeExporter commented 8 years ago
Can you try to reinstall the SDK, recreate the whole project, etc? Android is 
known to be buggy, and reinstalling and recreating everything usually fixes 
these kinds of issues.

Original comment by samuel.a...@gmail.com on 16 Sep 2013 at 11:37

GoogleCodeExporter commented 8 years ago
Apparently the problem was that whenever i compile the project, because i the 
.so files were not mentioned in my NDK MakeFile, they were deleted.

I created a new MakeFile including all .so files of javacv and the problem was 
solved.

Thanks for your interest and sorry for late response.

Original comment by cihancam...@gmail.com on 18 Sep 2013 at 12:34

GoogleCodeExporter commented 8 years ago
Ah! Good to know. Thank for the feedback!

Original comment by samuel.a...@gmail.com on 21 Sep 2013 at 2:03