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

Problem with ProGuard: ClassNotFoundException: org.bytedeco.javacpp.avutil #79

Open
lansedebing opened this issue Dec 30, 2014 · 63 comments

Comments

@lansedebing
Copy link

Caused by: java.lang.NoClassDefFoundError: java.lang.ClassNotFoundException: org.bytedeco.javacpp.avutil
at org.bytedeco.javacpp.Loader.load(Loader.java:387)
at org.bytedeco.javacpp.Loader.load(Loader.java:353)
at org.bytedeco.javacpp.avcodec$AVPacket.<clinit>(avcodec.java:1383)
at org.bytedeco.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:148)
at org.bytedeco.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:128)
@saudet
Copy link
Member

saudet commented Dec 30, 2014

Please try to follow the instructions here:
https://github.com/bytedeco/javacv

@lansedebing
Copy link
Author

It is still can not work, can you tell me which improtant step I may have ignored。

@saudet
Copy link
Member

saudet commented Dec 30, 2014

Please explain in detail what you are doing.

@lansedebing
Copy link
Author

I am developing an android app. I add javacv.jar javacpp.jar ffmpeg.jar opencv.jar into libs, extracts ffmpeg-android-arm.jar and opencv-android-arm.jar to get *.so files , put them into the armeabi folder

@saudet
Copy link
Member

saudet commented Dec 30, 2014

Don't do that. Please try to follow the instructions here:
https://github.com/bytedeco/javacv#manual-installation

@lansedebing
Copy link
Author

do i need to extract jar files to get *.so file? When i follow the manual-installation : Add External JARs..., i got a error : java.lang.VerifyError, so i have to Add Library..., but it can not work.

@saudet
Copy link
Member

saudet commented Dec 30, 2014

You seem to be trying to use the ADT plugin for Eclipse, which is buggy and isn't supported by Google anymore. Please install Android Studio, and follow the instructions for Android here:
https://github.com/bytedeco/javacv#manual-installation
If you do follow these instructions, it will work.

@lansedebing
Copy link
Author

ok,thank you very much

@lansedebing
Copy link
Author

When i used Android Studio ,I got "java.lang.NoClassDefFoundError: org/bytedeco/javacpp/avcodec$AVPacket"

@saudet
Copy link
Member

saudet commented Dec 31, 2014

Which JAR files are you using and how did you add them?

@lansedebing
Copy link
Author

I added javacv.jar javacpp.jar ffmpeg.jar opencv.jar iffmpeg-android-arm.jar and opencv-android-arm.jar into libs

@saudet
Copy link
Member

saudet commented Dec 31, 2014

And which ones are in the dependencies list?

@lansedebing
Copy link
Author

all

@lansedebing
Copy link
Author

image

@saudet
Copy link
Member

saudet commented Jan 3, 2015

I've just tried again with both FacePreview and RecordActivity samples just to make sure, and I have absolutely no problem with the JAR files from version 0.10.

What about you? Do you have the same issue with these two samples as well?

@cblong
Copy link

cblong commented Feb 13, 2015

As I see above, I have met same error with @lansedebing. And my project that i'm working on do not allow me to change IDE. So, I can't use javaCV on eclipse anymore, isn't it?
If it's true, another solution is use version 0.7 which deprecated. It work perfectly on eclipse but as i see, this version only support arm architecture. So, Will some device run with x86 soC get crash?
I need to cover devices as much as possible. What 's your solution @saudet ?

@saudet
Copy link
Member

saudet commented Feb 15, 2015

Which IDE you use has no relation to which libraries you can or cannot use. JavaCPP/JavaCV 0.10 does not work any worse or better than version 0.7 on Eclipse. It's just that Google itself does not support Eclipse for Android anymore, so if you do not feel like fighting Google, you should switch to Android Studio. I certainly don't feel like it, so I only provide free support in the case of Android Studio.

There are binaries for both android-arm and android-x86 platforms as part of the JavaCPP Presets, so simply use both of them to support both ARM and x86 devices.

@sethshal
Copy link

sethshal commented Apr 8, 2015

I have the same problem. I am using javacv 0.10 I have used the manual install and all the jar files mentioned above plus the ffmpegX86 opencvX86 in my lib folder. When I build with pro guard it gives me 841 warnings. I suppress them with the -dontwarn and the code compiles. At runtime I get the above error.

@saudet
Copy link
Member

saudet commented Apr 8, 2015

Does this still happen with version 0.11?

@sethshal
Copy link

sethshal commented Apr 8, 2015

I tried with version 0.11 too and I run into the same problem

@saudet
Copy link
Member

saudet commented Apr 8, 2015

@sethshal Could you provide more details about what is happening? I'm not getting any errors or warnings here. Thanks!

@sethshal
Copy link

sethshal commented Apr 8, 2015

Do you want the gradle build output without the -dontwarn? Or the log file when compiled with the -dontwarn and executed?

@sethshal
Copy link

sethshal commented Apr 8, 2015

Here are some of the warnings while building with pro guard

Warning: org.bytedeco.javacpp.tools.BuildMojo: can't find superclass or interface org.apache.maven.plugin.AbstractMojo
Warning: org.bytedeco.javacv.BaseChildSettings: can't find superclass or interface java.beans.beancontext.BeanContextChildSupport
Warning: org.bytedeco.javacv.BaseChildSettings$PropertyVetoExceptionThatNetBeansLikes: can't find superclass or interface java.beans.PropertyVetoException
Warning: org.bytedeco.javacv.BaseSettings: can't find superclass or interface java.beans.beancontext.BeanContextSupport
Warning: org.bytedeco.javacv.CanvasFrame: can't find superclass or interface javax.swing.JFrame
Warning: org.bytedeco.javacv.CanvasFrame$1MovedListener: can't find superclass or interface java.awt.event.ComponentAdapter
Warning: org.bytedeco.javacv.CanvasFrame$2: can't find superclass or interface java.awt.Canvas
Warning: org.bytedeco.javacv.CanvasFrame$3: can't find superclass or interface java.awt.KeyEventDispatcher
Warning: org.bytedeco.javacv.FrameGrabber$PropertyEditor: can't find superclass or interface java.beans.PropertyEditorSupport
Warning: org.bytedeco.javacv.GLCanvasFrame$2: can't find superclass or interface javax.media.opengl.GLEventListener
Warning: org.bytedeco.javacpp.tools.BuildMojo: can't find referenced class org.apache.maven.plugin.AbstractMojo
Warning: org.bytedeco.javacpp.tools.BuildMojo: can't find referenced method 'org.apache.maven.plugin.logging.Log getLog()' in program class org.bytedeco.javacpp.tools.BuildMojo
Warning: org.bytedeco.javacpp.tools.BuildMojo: can't find referenced class org.apache.maven.plugin.logging.Log
Warning: org.bytedeco.javacpp.tools.BuildMojo: can't find referenced class org.apache.maven.plugin.logging.Log
Warning: org.bytedeco.javacpp.tools.BuildMojo: can't find referenced class org.apache.maven.plugin.logging.Log
Warning: org.bytedeco.javacpp.tools.BuildMojo: can't find referenced class org.apache.maven.project.MavenProject
Warning: org.bytedeco.javacpp.tools.BuildMojo: can't find referenced class org.apache.maven.plugin.logging.Log
Warning: org.bytedeco.javacpp.tools.BuildMojo: can't find referenced class org.apache.maven.plugin.MojoExecutionException
Warning: org.bytedeco.javacpp.tools.BuildMojo: can't find referenced class org.apache.maven.plugin.MojoExecutionException
Warning: org.bytedeco.javacpp.tools.BuildMojo: can't find referenced class org.apache.maven.plugin.AbstractMojo
Warning: org.bytedeco.javacpp.tools.BuildMojo: can't find referenced class org.apache.maven.plugin.logging.Log
Warning: org.bytedeco.javacpp.tools.BuildMojo: can't find referenced class org.apache.maven.plugin.logging.Log
Warning: org.bytedeco.javacpp.tools.BuildMojo: can't find referenced class org.apache.maven.project.MavenProject
Warning: org.bytedeco.javacpp.tools.BuildMojo: can't find referenced class org.apache.maven.project.MavenProject
Warning: org.bytedeco.javacpp.tools.BuildMojo: can't find referenced class org.apache.maven.plugin.logging.Log
Warning: org.bytedeco.javacpp.tools.BuildMojo$1: can't find referenced class org.apache.maven.plugin.logging.Log
Warning: org.bytedeco.javacpp.tools.BuildMojo$1: can't find referenced class org.apache.maven.plugin.logging.Log
Warning: org.bytedeco.javacpp.tools.BuildMojo$1: can't find referenced class org.apache.maven.plugin.logging.Log
Warning: org.bytedeco.javacpp.tools.BuildMojo$1: can't find referenced class org.apache.maven.plugin.logging.Log
Warning: org.bytedeco.javacpp.tools.BuildMojo$1: can't find referenced class org.apache.maven.plugin.logging.Log
Warning: org.bytedeco.javacpp.tools.BuildMojo$1: can't find referenced class org.apache.maven.plugin.logging.Log
Warning: org.bytedeco.javacpp.tools.BuildMojo$1: can't find referenced class org.apache.maven.plugin.logging.Log
Warning: org.bytedeco.javacv.BaseChildSettings: can't find referenced class java.beans.beancontext.BeanContextChildSupport
Warning: org.bytedeco.javacv.BaseChildSettings: can't find referenced field 'java.beans.PropertyChangeSupport pcSupport' in program class org.bytedeco.javacv.BaseChildSettings
Warning: org.bytedeco.javacv.BaseChildSettings: can't find referenced class java.beans.beancontext.BeanContextChildSupport
Warning: org.bytedeco.javacv.BaseChildSettings: can't find referenced class java.beans.beancontext.BeanContextChildSupport
Warning: org.bytedeco.javacv.BaseChildSettings$PropertyVetoExceptionThatNetBeansLikes: can't find referenced class java.beans.PropertyVetoException
Warning: org.bytedeco.javacv.BaseChildSettings$PropertyVetoExceptionThatNetBeansLikes: can't find referenced method 'java.lang.String getMessage()' in program class org.bytedeco.javacv.BaseChildSettings$PropertyVetoExceptionThatNetBeansLikes
Warning: org.bytedeco.javacv.BaseChildSettings$PropertyVetoExceptionThatNetBeansLikes: can't find referenced class java.beans.PropertyVetoException
Warning: org.bytedeco.javacv.BaseChildSettings$PropertyVetoExceptionThatNetBeansLikes$1: can't find referenced method 'java.lang.String getMessage()' in program class org.bytedeco.javacv.BaseChildSettings$PropertyVetoExceptionThatNetBeansLikes
Warning: org.bytedeco.javacv.BaseSettings: can't find referenced class java.beans.beancontext.BeanContextSupport
Warning: org.bytedeco.javacv.BaseSettings: can't find referenced field 'java.beans.PropertyChangeSupport pcSupport' in program class org.bytedeco.javacv.BaseSettings
Warning: org.bytedeco.javacv.BaseSettings: can't find referenced class java.beans.beancontext.BeanContextSupport
Warning: org.bytedeco.javacv.BaseSettings: can't find referenced class java.beans.beancontext.BeanContextSupport
Warning: org.bytedeco.javacv.BaseSettings: can't find referenced class java.beans.beancontext.BeanContextSupport
Warning: org.bytedeco.javacv.BaseSettings: can't find referenced class java.beans.beancontext.BeanContextSupport
Warning: org.bytedeco.javacv.CameraDevice$CalibratedSettings: can't find referenced class java.beans.PropertyVetoException
Warning: org.bytedeco.javacv.CameraDevice$CalibratedSettings$1: can't find referenced method 'void firePropertyChange(java.lang.String,java.lang.Object,java.lang.Object)' in program class org.bytedeco.javacv.CameraDevice$CalibratedSettings
Warning: org.bytedeco.javacv.CameraDevice$CalibrationSettings: can't find referenced class java.beans.PropertyVetoException
Warning: org.bytedeco.javacv.CameraDevice$CalibrationSettings$1: can't find referenced method 'void firePropertyChange(java.lang.String,java.lang.Object,java.lang.Object)' in program class org.bytedeco.javacv.CameraDevice$CalibrationSettings
Warning: org.bytedeco.javacv.CameraDevice$Settings: can't find referenced class java.beans.PropertyVetoException

@sethshal
Copy link

sethshal commented Apr 8, 2015

I am trying to use FFmpegFrameRecorder to generate a slideshow from a set
of pictures.

I am attaching the screen shot to list my libraries. And also the the
dependencies on my gradle build file

On Wed, Apr 8, 2015 at 10:47 AM, Samuel Audet notifications@github.com
wrote:

@sethshal https://github.com/sethshal Could you provide more details
about what is happening? I'm not getting any errors or warnings here.
Thanks!


Reply to this email directly or view it on GitHub
#79 (comment).

@sethshal
Copy link

sethshal commented Apr 8, 2015

screen shot 2015-04-08 at 11 09 16 am

@sethshal
Copy link

sethshal commented Apr 8, 2015

I tried running the app by suppressing the warnings and with the latest 0.11 Here is the error at runtime

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.milestones-1/base.apk"],nativeLibraryDirectories=[/data/app/com.milestones-1/lib/arm, /vendor/lib, /system/lib]]] couldn't find "libjniPointer.so"
            at java.lang.Runtime.loadLibrary(Runtime.java:366)
            at java.lang.System.loadLibrary(System.java:989)
            at org.bytedeco.javacpp.b.a(Unknown Source)
            at org.bytedeco.javacpp.b.b(Unknown Source)
            at org.bytedeco.javacpp.b.d(Unknown Source)
            at org.bytedeco.javacpp.avcodec$AVPacket.<clinit>(Unknown Source)
            at org.bytedeco.a.c.<init>(Unknown Source)
            at com.milestones.MilestoneSlideshowActivity.a(Unknown Source)
            at com.milestones.MilestoneSlideshowActivity.onCreate(Unknown Source)
            at android.app.Activity.performCreate(Activity.java:5933)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
            at android.app.ActivityThread.access$800(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5221)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
     Caused by: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.milestones-1/base.apk"],nativeLibraryDirectories=[/data/app/com.milestones-1/lib/arm, /vendor/lib, /system/lib]]] couldn't find "libgnustl_static.so"
            at java.lang.Runtime.loadLibrary(Runtime.java:366)
            at java.lang.System.loadLibrary(System.java:989)
            at org.bytedeco.javacpp.b.a(Unknown Source)
            at org.bytedeco.javacpp.b.b(Unknown Source)
            at org.bytedeco.javacpp.b.d(Unknown Source)
            at org.bytedeco.javacpp.avcodec$AVPacket.<clinit>(Unknown Source)
            at org.bytedeco.a.c.<init>(Unknown Source)
            at com.milestones.MilestoneSlideshowActivity.a(Unknown Source)
            at com.milestones.MilestoneSlideshowActivity.onCreate(Unknown Source)
            at android.app.Activity.performCreate(Activity.java:5933)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
            at android.app.ActivityThread.access$800(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5221)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

@saudet
Copy link
Member

saudet commented Apr 9, 2015

Hum, so ProGuard doesn't ignore and remove unused class? It's a bit less powerful that I thought. We should think about what to do for that...

couldn't find "libjniPointer.so" <- I've had a couple of reports in the past about that, but I've never been able to reproduce it. Could you provide your build.gradle file and anything else that you're doing to set up your poject files so I can reproduce that here? Thanks!

@sethshal
Copy link

sethshal commented Apr 9, 2015

Here is the relevant part of the build file

buildTypes {
    release {
        shrinkResources true
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        signingConfig signingConfigs.release
        debuggable false
        jniDebuggable false
        renderscriptDebuggable true
    }
}

pro guard rules text file has

-dontwarn org.bytedeco.javacv.**
-dontwarn org.bytedeco.javacpp.**

@saudet
Copy link
Member

saudet commented Apr 12, 2015

I see the problem. I remember where I saw problems like that before:
https://groups.google.com/forum/#!topic/javacpp-project/qAQkOUrqOZw

Basically, the problem is that JavaCPP uses the @Platform annotation at runtime, but ProGuard removes all annotations. I've tried -keepattributes * but that doesn't seem to be working with Android Studio.

Once we figure this out, it would be nice to have this documented properly, so if you have some time, please create a nice wiki page explaining what we should do! You should have write permission:
https://github.com/bytedeco/javacv/wiki

Or alternatively, we could put sample project files here:
https://github.com/bytedeco/sample-projects

Thanks for reporting and checking this out!!

@sethshal
Copy link

I do include the javacv.jar file as the project does not compile without it.

On Tue, May 12, 2015 at 9:56 AM, Laurens Versluis notifications@github.com
wrote:

Are you including more libraries or jars besides the 4 I have mentioned in
the wiki? I do recall that in debug mode my app was around 50-60mb with
minify enabled and when building release it got down to 40mb. So I never
got even close to 90 mb.

Besides, if that are the only two lines you use, proguard should even
reduce more in your app since all my rules are keep statements and dontwarn.


Reply to this email directly or view it on GitHub
#79 (comment).

@lfdversluis
Copy link
Contributor

add the following dependency en remove the jar (I have no jars in my libs folder at all): compile group: 'org.bytedeco', name: 'javacv', version: '0.11'

@sethshal
Copy link

Thats how I have it right now. I had done a manual install before but with
your wiki page I started afresh and removed the jars from the libs folder

On Tue, May 12, 2015 at 10:43 AM, Laurens Versluis <notifications@github.com

wrote:

add the following dependency en remove the jar (I have no jars in my libs
folder at all):
compile group: 'org.bytedeco', name: 'javacv', version: '0.11'


Reply to this email directly or view it on GitHub
#79 (comment).

@Yuriy-Svetlov
Copy link

Hello all. I have problem.Please help me. Sometimes/ rarely errors :

java.lang.ExceptionInInitializerError
at com.aosc.brucha.VideoService.initRecorder(VideoService.java:159)
at com.aosc.brucha.VideoService.init(VideoService.java:104)
at com.aosc.brucha.VideoService.access$200(VideoService.java:49)
at com.aosc.brucha.VideoService$2.loadComplete(VideoService.java:282)
at com.aosc.brucha.VideoService$2.loadComplete(VideoService.java:276)
at com.registration.API$Builder$2.success(API.java:108)
at com.registration.API$Builder$2.success(API.java:102)
at retrofit.CallbackRunnable$1.run(CallbackRunnable.java:45)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4517)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ExceptionInInitializerError
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:217)
at com.googlecode.javacpp.Loader.load(Loader.java:561)
at com.googlecode.javacpp.Loader.load(Loader.java:540)
at com.googlecode.javacv.cpp.opencv_core$CvArr.<clinit>(opencv_core.java:156)
... 17 more
Caused by: java.lang.UnsatisfiedLinkError: Couldn't load jniopencv_core: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:365)
at java.lang.System.loadLibrary(System.java:535)
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:711)
at com.googlecode.javacpp.Loader.load(Loader.java:586)
at com.googlecode.javacpp.Loader.load(Loader.java:540)
at com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:134)
... 22 more
Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: load_segments[916]: 110 failed to map segment from 'libjniopencv_core.so' @ 0x52504000 (0x000a0e14). p_vaddr=0x00000000 p_offset=0x00000000
at java.lang.Runtime.load(Runtime.java:340)
at java.lang.System.load(System.java:521)
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:700)
... 25 more

@saudet
Copy link
Member

saudet commented May 15, 2015

@semiromid Please try again with version 0.11

@Yuriy-Svetlov
Copy link

Ок

@lfdversluis
Copy link
Contributor

@sethshal Ok, I see the issue. When you compile the app for release, it compresses stuff. So my app ends up being 39.5MB. Now when you install it, it becomes ~85MB. That explains your size. To reduce size, maybe something like this http://stackoverflow.com/questions/30393603/android-gradle-load-and-compile-libraries-based-on-architecture will work... But I have not figured that out yet. If you do, add it to the wiki!

@sethshal
Copy link

Oh so your apt size was 39.5 MB. That makes sense. @samuel I haven't done
this before. But I was thinking of just using the .so files I need for my
project. Is there any documentation or guidelines around it? How do I find
out which files to include?

On Mon, May 25, 2015 at 5:06 PM, Laurens Versluis notifications@github.com
wrote:

@sethshal https://github.com/sethshal Ok, I see the issue. When you
compile the app for release, it compresses stuff. So my app ends up being
39.5MB. Now when you install it, it becomes ~90MB. That explains your size.


Reply to this email directly or view it on GitHub
#79 (comment).

@saudet
Copy link
Member

saudet commented May 27, 2015

@sethshal Try to strip them out one by one, and put back those without which your app doesn't work :)

@Kaitis
Copy link

Kaitis commented May 27, 2015

@lfdversluis I followed the directions in the wiki page you create but I am still getting errors:

05-27 13:13:39.822  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ No JNI_OnLoad found in /system/lib/libc.so 0xa50913f0, skipping init
05-27 13:13:39.822  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ No JNI_OnLoad found in /system/lib/libm.so 0xa50913f0, skipping init
05-27 13:13:39.822  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ No JNI_OnLoad found in /system/lib/libz.so 0xa50913f0, skipping init
05-27 13:13:39.822  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ No JNI_OnLoad found in /system/lib/libdl.so 0xa50913f0, skipping init
05-27 13:13:39.826  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ No JNI_OnLoad found in /system/lib/liblog.so 0xa50913f0, skipping init
05-27 13:13:39.826  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Trying to load lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libopencv_core.so 0xa50913f0
05-27 13:13:39.826  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Added shared lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libopencv_core.so 0xa50913f0
05-27 13:13:39.826  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ No JNI_OnLoad found in /data/app-lib/com.example.andreaskaitis.myapplication-2/libopencv_core.so 0xa50913f0, skipping init
05-27 13:13:39.826  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Trying to load lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libjniopencv_core.so 0xa50913f0
05-27 13:13:39.826  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Added shared lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libjniopencv_core.so 0xa50913f0
05-27 13:13:39.842  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Trying to load lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libopencv_imgproc.so 0xa50913f0
05-27 13:13:39.870  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Added shared lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libopencv_imgproc.so 0xa50913f0
05-27 13:13:39.870  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ No JNI_OnLoad found in /data/app-lib/com.example.andreaskaitis.myapplication-2/libopencv_imgproc.so 0xa50913f0, skipping init
05-27 13:13:39.870  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Trying to load lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libjniopencv_imgproc.so 0xa50913f0
05-27 13:13:39.870  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Added shared lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libjniopencv_imgproc.so 0xa50913f0
05-27 13:13:39.874  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Trying to load lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r2.3.3.so 0xa50913f0
05-27 13:13:39.874  29905-29905/com.example.andreaskaitis.myapplication E/dalvikvm﹕ dlopen("/data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r2.3.3.so") failed: dlopen failed: library "/system/lib/libhoudini.so" not found
05-27 13:13:39.874  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Trying to load lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r3.0.1.so 0xa50913f0
05-27 13:13:39.874  29905-29905/com.example.andreaskaitis.myapplication E/dalvikvm﹕ dlopen("/data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r3.0.1.so") failed: dlopen failed: library "/system/lib/libhoudini.so" not found
05-27 13:13:39.874  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Trying to load lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r4.0.3.so 0xa50913f0
05-27 13:13:39.874  29905-29905/com.example.andreaskaitis.myapplication E/dalvikvm﹕ dlopen("/data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r4.0.3.so") failed: dlopen failed: library "/system/lib/libhoudini.so" not found
05-27 13:13:39.874  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Trying to load lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r4.1.1.so 0xa50913f0
05-27 13:13:39.878  29905-29905/com.example.andreaskaitis.myapplication E/dalvikvm﹕ dlopen("/data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r4.1.1.so") failed: dlopen failed: library "/system/lib/libhoudini.so" not found
05-27 13:13:39.878  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Trying to load lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r4.2.0.so 0xa50913f0
05-27 13:13:39.878  29905-29905/com.example.andreaskaitis.myapplication E/dalvikvm﹕ dlopen("/data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r4.2.0.so") failed: dlopen failed: library "/system/lib/libhoudini.so" not found
05-27 13:13:39.878  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Trying to load lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r4.3.0.so 0xa50913f0
05-27 13:13:39.878  29905-29905/com.example.andreaskaitis.myapplication E/dalvikvm﹕ dlopen("/data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r4.3.0.so") failed: dlopen failed: library "/system/lib/libhoudini.so" not found
05-27 13:13:39.878  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Trying to load lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r4.4.0.so 0xa50913f0
05-27 13:13:39.878  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Added shared lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r4.4.0.so 0xa50913f0
05-27 13:13:39.878  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ No JNI_OnLoad found in /data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r4.4.0.so 0xa50913f0, skipping init
05-27 13:13:39.882  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Trying to load lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libopencv_highgui.so 0xa50913f0
05-27 13:13:39.882  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Added shared lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libopencv_highgui.so 0xa50913f0
05-27 13:13:39.882  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ No JNI_OnLoad found in /data/app-lib/com.example.andreaskaitis.myapplication-2/libopencv_highgui.so 0xa50913f0, skipping init
05-27 13:13:39.882  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Trying to load lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libjniopencv_highgui.so 0xa50913f0
05-27 13:13:39.882  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Added shared lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libjniopencv_highgui.so 0xa50913f0
05-27 13:13:39.886  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Trying to load lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r2.3.3.so 0xa50913f0
05-27 13:13:39.886  29905-29905/com.example.andreaskaitis.myapplication E/dalvikvm﹕ dlopen("/data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r2.3.3.so") failed: dlopen failed: library "/system/lib/libhoudini.so" not found
05-27 13:13:39.886  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Trying to load lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r3.0.1.so 0xa50913f0
05-27 13:13:39.886  29905-29905/com.example.andreaskaitis.myapplication E/dalvikvm﹕ dlopen("/data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r3.0.1.so") failed: dlopen failed: library "/system/lib/libhoudini.so" not found
05-27 13:13:39.886  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Trying to load lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r4.0.3.so 0xa50913f0
05-27 13:13:39.886  29905-29905/com.example.andreaskaitis.myapplication E/dalvikvm﹕ dlopen("/data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r4.0.3.so") failed: dlopen failed: library "/system/lib/libhoudini.so" not found
05-27 13:13:39.886  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Trying to load lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r4.1.1.so 0xa50913f0
05-27 13:13:39.890  29905-29905/com.example.andreaskaitis.myapplication E/dalvikvm﹕ dlopen("/data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r4.1.1.so") failed: dlopen failed: library "/system/lib/libhoudini.so" not found
05-27 13:13:39.890  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Trying to load lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r4.2.0.so 0xa50913f0
05-27 13:13:39.890  29905-29905/com.example.andreaskaitis.myapplication E/dalvikvm﹕ dlopen("/data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r4.2.0.so") failed: dlopen failed: library "/system/lib/libhoudini.so" not found
05-27 13:13:39.890  29905-29905/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Trying to load lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r4.3.0.so 0xa50913f0
05-27 13:13:39.890  29905-29905/com.example.andreaskaitis.myapplication E/dalvikvm﹕ dlopen("/data/app-lib/com.example.andreaskaitis.myapplication-2/libnative_camera_r4.3.0.so") failed: dlopen failed: library "/system/lib/libhoudini.so" not found
05-27 13:13:39.910  29905-30441/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Trying to load lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libavutil.so 0xa50913f0
05-27 13:13:39.914  29905-30441/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Added shared lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libavutil.so 0xa50913f0
05-27 13:13:39.914  29905-30441/com.example.andreaskaitis.myapplication D/dalvikvm﹕ No JNI_OnLoad found in /data/app-lib/com.example.andreaskaitis.myapplication-2/libavutil.so 0xa50913f0, skipping init
05-27 13:13:39.914  29905-30441/com.example.andreaskaitis.myapplication D/dalvikvm﹕ GC_FOR_ALLOC freed 2304K, 17% free 22780K/27176K, paused 3ms, total 3ms
05-27 13:13:39.918  29905-30441/com.example.andreaskaitis.myapplication D/dalvikvm﹕ Trying to load lib /data/app-lib/com.example.andreaskaitis.myapplication-2/libjniavutil.so 0xa50913f0
05-27 13:13:39.922  29905-30441/com.example.andreaskaitis.myapplication E/dalvikvm﹕ dlopen("/data/app-lib/com.example.andreaskaitis.myapplication-2/libjniavutil.so") failed: dlopen failed: library "/system/lib/libhoudini.so" not found
05-27 13:13:39.922  29905-30441/com.example.andreaskaitis.myapplication W/dalvikvm﹕ Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lorg/bytedeco/javacpp/avutil;
05-27 13:13:39.926  29905-30441/com.example.andreaskaitis.myapplication I/dalvikvm﹕ Rejecting re-init on previously-failed class Lorg/bytedeco/javacpp/avutil; v=0x0
05-27 13:13:39.926  29905-30441/com.example.andreaskaitis.myapplication W/dalvikvm﹕ Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lorg/bytedeco/javacpp/avcodec$AVPacket;
05-27 13:13:39.926  29905-30441/com.example.andreaskaitis.myapplication W/dalvikvm﹕ threadid=20: thread exiting with uncaught exception (group=0xa4d11b20)
05-27 13:13:39.926  29905-30441/com.example.andreaskaitis.myapplication E/AndroidRuntime﹕ FATAL EXCEPTION: AsyncTask #1
    Process: com.example.andreaskaitis.myapplication, PID: 29905
    java.lang.RuntimeException: An error occured while executing doInBackground()
            at android.os.AsyncTask$3.done(AsyncTask.java:300)
            at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
            at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
            at java.util.concurrent.FutureTask.run(FutureTask.java:242)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:841)
     Caused by: java.lang.NoClassDefFoundError: java.lang.ClassNotFoundException: org.bytedeco.javacpp.avutil
            at org.bytedeco.javacpp.Loader.load(Loader.java:388)
            at org.bytedeco.javacpp.Loader.load(Loader.java:354)
            at org.bytedeco.javacpp.avcodec$AVPacket.<clinit>(avcodec.java:1405)
            at org.bytedeco.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:147)
            at org.bytedeco.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:124)
            at com.example.andreaskaitis.myapplication.WriteMovieActivity$2.doInBackground(WriteMovieActivity.java:550)
            at com.example.andreaskaitis.myapplication.WriteMovieActivity$2.doInBackground(WriteMovieActivity.java:534)
            at android.os.AsyncTask$2.call(AsyncTask.java:288)
            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:841)
     Caused by: java.lang.ClassNotFoundException: org.bytedeco.javacpp.avutil
            at java.lang.Class.classForName(Native Method)
            at java.lang.Class.forName(Class.java:251)
            at org.bytedeco.javacpp.Loader.load(Loader.java:386)
            at org.bytedeco.javacpp.Loader.load(Loader.java:354)
            at org.bytedeco.javacpp.avcodec$AVPacket.<clinit>(avcodec.java:1405)
            at org.bytedeco.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:147)
            at org.bytedeco.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:124)
            at com.example.andreaskaitis.myapplication.WriteMovieActivity$2.doInBackground(WriteMovieActivity.java:550)
            at com.example.andreaskaitis.myapplication.WriteMovieActivity$2.doInBackground(WriteMovieActivity.java:534)
            at android.os.AsyncTask$2.call(AsyncTask.java:288)
            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:841)
     Caused by: java.lang.NoClassDefFoundError: org/bytedeco/javacpp/avutil
            at java.lang.Class.classForName(Native Method)
            at java.lang.Class.forName(Class.java:251)
            at org.bytedeco.javacpp.Loader.load(Loader.java:386)
            at org.bytedeco.javacpp.Loader.load(Loader.java:354)
            at org.bytedeco.javacpp.avcodec$AVPacket.<clinit>(avcodec.java:1405)
            at org.bytedeco.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:147)
            at org.bytedeco.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:124)
            at com.example.andreaskaitis.myapplication.WriteMovieActivity$2.doInBackground(WriteMovieActivity.java:550)
            at com.example.andreaskaitis.myapplication.WriteMovieActivity$2.doInBackground(WriteMovieActivity.java:534)
            at android.os.AsyncTask$2.call(AsyncTask.java:288)
            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:841)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "org.bytedeco.javacpp.avutil" on path: DexPathList[[zip file "/data/app/com.example.andreaskaitis.myapplication-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.andreaskaitis.myapplication-2, /system/lib]]
            at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
            at java.lang.Class.classForName(Native Method)
            at java.lang.Class.forName(Class.java:251)
            at org.bytedeco.javacpp.Loader.load(Loader.java:386)
            at org.bytedeco.javacpp.Loader.load(Loader.java:354)
            at org.bytedeco.javacpp.avcodec$AVPacket.<clinit>(avcodec.java:1405)
            at org.bytedeco.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:147)
            at org.bytedeco.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:124)
            at com.example.andreaskaitis.myapplication.WriteMovieActivity$2.doInBackground(WriteMovieActivity.java:550)
            at com.example.andreaskaitis.myapplication.WriteMovieActivity$2.doInBackground(WriteMovieActivity.java:534)
            at android.os.AsyncTask$2.call(AsyncTask.java:288)
            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:841)

Any ideas on what to try next?

@sethshal
Copy link

@saudet Does it matter where I copy the .so files?

@saudet
Copy link
Member

saudet commented May 30, 2015

@sethshal Of course it matters. Please ask the Android team for information regarding your native platform, and let us know what you find! Thanks

@saudet saudet changed the title Encounter a problem in 0.10 ClassNotFoundException: org.bytedeco.javacpp.avutil Problem with ProGuard: ClassNotFoundException: org.bytedeco.javacpp.avutil Jul 4, 2015
@skyfe79
Copy link

skyfe79 commented Aug 26, 2015

For android, I wrote the build.gradle as below. Everything is good.

dependencies {
    compile group: 'org.bytedeco', name: 'javacv', version: '1.0'
    compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '2.4.11-0.11', classifier: 'android-arm'
    compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '2.6.1-0.11', classifier: 'android-arm'
}

@beckondelve1
Copy link

hi Saudet, i'm facing same problem,
i have updated both file javacv and javacpp from download from github, full zip 135 mb.
I just copy "RecordActivity" to our example and try to use things but everything same issue reported.. App crash when i start recording.
Showing me this logcat

09-21 19:15:49.676: E/dalvikvm(25769): Could not find class 'org.bytedeco.javacpp.avcodec$AVPacket', referenced from method org.bytedeco.javacv.FFmpegFrameRecorder.<init>
09-21 19:15:49.676: E/dalvikvm(25769): Could not find class 'org.bytedeco.javacpp.avutil', referenced from method org.bytedeco.javacv.FFmpegFrameRecorder.tryLoad
09-21 19:15:49.681: E/dalvikvm(25769): Could not find class 'org.bytedeco.javacpp.avcodec', referenced from method org.bytedeco.javacv.FFmpegFrameRecorder.release
09-21 19:15:49.691: E/dalvikvm(25769): Could not find class 'org.bytedeco.javacpp.avcodec', referenced from method org.bytedeco.javacv.FFmpegFrameRecorder.start
09-21 19:15:49.706: E/AndroidRuntime(25769): FATAL EXCEPTION: main
09-21 19:15:49.706: E/AndroidRuntime(25769): Process: com.example.testswitchcam, PID: 25769
09-21 19:15:49.706: E/AndroidRuntime(25769): java.lang.NoClassDefFoundError: org.bytedeco.javacpp.avcodec$AVPacket
09-21 19:15:49.706: E/AndroidRuntime(25769):    at org.bytedeco.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:149)
09-21 19:15:49.706: E/AndroidRuntime(25769):    at com.example.testswitchcam.RecordActivity.initRecorder(RecordActivity.java:277)
09-21 19:15:49.706: E/AndroidRuntime(25769):    at com.example.testswitchcam.RecordActivity.startRecording(RecordActivity.java:292)
09-21 19:15:49.706: E/AndroidRuntime(25769):    at com.example.testswitchcam.RecordActivity.onClick(RecordActivity.java:584)
09-21 19:15:49.706: E/AndroidRuntime(25769):    at android.view.View.performClick(View.java:4654)
09-21 19:15:49.706: E/AndroidRuntime(25769):    at android.view.View$PerformClick.run(View.java:19438)
09-21 19:15:49.706: E/AndroidRuntime(25769):    at android.os.Handler.handleCallback(Handler.java:733)
09-21 19:15:49.706: E/AndroidRuntime(25769):    at android.os.Handler.dispatchMessage(Handler.java:95)
09-21 19:15:49.706: E/AndroidRuntime(25769):    at android.os.Looper.loop(Looper.java:146)
09-21 19:15:49.706: E/AndroidRuntime(25769):    at android.app.ActivityThread.main(ActivityThread.java:5602)
09-21 19:15:49.706: E/AndroidRuntime(25769):    at java.lang.reflect.Method.invokeNative(Native Method)
09-21 19:15:49.706: E/AndroidRuntime(25769):    at java.lang.reflect.Method.invoke(Method.java:515)
09-21 19:15:49.706: E/AndroidRuntime(25769):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
09-21 19:15:49.706: E/AndroidRuntime(25769):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
09-21 19:15:49.706: E/AndroidRuntime(25769):    at dalvik.system.NativeStart.main(Native Method)

@saudet
Copy link
Member

saudet commented Nov 3, 2015

@lfdversluis So, are you confident that your instructions on the wiki fixes all and every problem related to ProGuard, and we can close this issue? Let me know! Thanks

@lfdversluis
Copy link
Contributor

@saudet I recall @sethshal having issues with it. I did not gain any errors but then again every architecture (and almost every phone) is different. I hope @sethshal can comment if he has issues or managed to fix them (and update the wiki if needed)

@sethshal
Copy link

sethshal commented Nov 4, 2015

I haven't worked on the project for a while. So I haven't had a chance to test any new build. The last I had tried it the app size was huge as I had to disable proguard. I had managed to reduce the app size a bit by removing so library files.

@Jamoke
Copy link

Jamoke commented Dec 4, 2015

It was a long read. But I've read all the posts, and desperately need to get this working. I approached it skeptically, but the instructions on the wiki page were very helpful, and after adjusting the proguard settings manually, and following ALL of the instructions, I still get this error:

E/System: Uncaught exception thrown by finalizer
E/System: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/bytedeco/javacpp/avcodec;

my build.gradle has:

dependencies {
    compile group: 'org.bytedeco', name: 'javacv', version: '1.1'
    compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.0.0-1.1', classifier: 'android-arm'
    compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.0.0-1.1', classifier: 'android-x86'
    compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '2.8.1-1.1', classifier: 'android-arm'
    compile group: 'org.bytedeco.javacpp-presets', name: 'ffmpeg', version: '2.8.1-1.1', classifier: 'android-x86'
}

I also tried previous versions of ffmpeg and openCV (2.6.1, 2.4.1, etc) which were stated to be working in this thread. My proguard-rules.pro file contains the instructions straight from the wiki today. ( https://github.com/bytedeco/javacv/wiki/Configuring-Proguard-for-JavaCV ) Again, the instructions were good, and appear to work, because before these settings were applied, I was getting duplicate symbols for including the ffmpeg library, as well as the ffmpeg x86, and ffmpeg arm libraries. So I think that certainly helps when compiling with Android SDK 23 build tools for multiple platforms. However I still get the error. I am running on a Galaxy S6 (which is Arm-64).

*Edit: I was wrong. It didn't compile correctly, and it was using a cached APK with the manaul copies of the JAR files for deploying to device. the compiler when I had the proguard settings, and the dependencies setup the error was:

What went wrong:

Execution failed for task ':app:transformResourcesWithMergeJavaResForDevDebug'.
com.android.build.api.transform.TransformException: >com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META->INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.properties
File1: /Users/[me]/.gradle/caches/modules-2/files-2.1/org.bytedeco.javacpp-presets/ffmpeg/2.8.1-1.1/e887e3cf952e0aa10212467c399d94a4daa78e2e/ffmpeg-2.8.1-1.1.jar
File2: /Users/[me]/.gradle/caches/modules-2/files-2.1/org.bytedeco.javacpp-presets/ffmpeg/2.8.1-1.1/e9de6569f01f6546da3e51ea1315bb933a38e11c/ffmpeg-2.8.1-1.1-android-arm.jar
*

**Edit 2: I fixed the duplicate file exception by adding:

packagingOptions {
exclude 'META-INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.properties'
exclude 'META-INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.xml'
}

but now the gradle console output is throwing a new exciting error:

Execution failed for task ':app:transformClassesAndResourcesWithProguardForDevDebug'.
java.io.IOException: Can't write ...../build/intermediates/transforms/proguard/dev/debug/jars/3/1f/main.jar
(Can't read ......./org.bytedeco.javacpp-presets/opencv/3.0.0-1.1/[hash]/opencv-3.0.0-1.1.jar(;;;;;;*/.class)
(Duplicate zip entry opencv-3.0.0-1.1.jar:org/bytedeco/javacpp/opencv_videostab$ColorInpainter.class))
**

*** Edit 3: I had the jar files and the dependencies defined... Cost of trying to many options. I was able to get the compiler errors to go away, and it looks like everything is working now. As a note: I specifically did NOT need to update the proguard manually per the wiki. That in fact caused a myriad of problems... The proguard that ships with Android SDK / Android Studio now works fine.


@crossmo
Copy link

crossmo commented Dec 8, 2015

Hi, I followed the wiki instructions but still got the ClassNotFoundException with difference stack trace output:

12-08 20:12:39.295 15740-15901/demo.android D/dalvikvm: No JNI_OnLoad found in /system/lib/libc.so 0x423e4c28, skipping init
12-08 20:12:39.305 15740-15901/demo.android D/dalvikvm: No JNI_OnLoad found in /system/lib/libm.so 0x423e4c28, skipping init
12-08 20:12:39.305 15740-15901/demo.android D/dalvikvm: No JNI_OnLoad found in /system/lib/libz.so 0x423e4c28, skipping init
12-08 20:12:39.315 15740-15901/demo.android D/dalvikvm: No JNI_OnLoad found in /system/lib/libdl.so 0x423e4c28, skipping init
12-08 20:12:39.335 15740-15901/demo.android D/dalvikvm: No JNI_OnLoad found in /system/lib/liblog.so 0x423e4c28, skipping init
12-08 20:12:39.335 15740-15901/demo.android D/dalvikvm: Trying to load lib /data/app-lib/demo.android-41/libavutil.so 0x423e4c28
12-08 20:12:39.345 15740-15901/demo.android D/dalvikvm: Added shared lib /data/app-lib/demo.android-41/libavutil.so 0x423e4c28
12-08 20:12:39.345 15740-15901/demo.android D/dalvikvm: No JNI_OnLoad found in /data/app-lib/demo.android-41/libavutil.so 0x423e4c28, skipping init
12-08 20:12:39.345 15740-15901/demo.android W/dalvikvm: Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lorg/bytedeco/javacpp/avutil;
12-08 20:12:39.385 15740-15901/demo.android I/dalvikvm: Rejecting re-init on previously-failed class Lorg/bytedeco/javacpp/avutil; v=0x0
12-08 20:12:39.385 15740-15901/demo.android W/dalvikvm: Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lorg/bytedeco/javacpp/avcodec$AVPacket;
12-08 20:12:39.415 15740-15901/demo.android E/toard: Handling intent
                                                                java.lang.NoClassDefFoundError: java.lang.ClassNotFoundException: org.bytedeco.javacpp.avutil
                                                                    at org.bytedeco.javacpp.Loader.load(Loader.java:415)
                                                                    at org.bytedeco.javacpp.Loader.load(Loader.java:381)
                                                                    at org.bytedeco.javacpp.avcodec$AVPacket.<clinit>(avcodec.java:1650)
                                                                    at org.bytedeco.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:149)


Don't know why such many .so libs were not found and ignored up there, which may cause the exception. Did I miss anything??

Thanks.

@Jamoke
Copy link

Jamoke commented Dec 8, 2015

If the libraries are missing, then the proguard didn't run correctly... Did you follow the steps in this wiki document:

https://github.com/bytedeco/javacv/wiki/Configuring-Proguard-for-JavaCV

(P.S. - in regards to the "Upgrade your proguard in the Android SDK" I didn't need to replace my Proguard version. The one that came with Android SDK was new enough as of now [December 2015])

@crossmo
Copy link

crossmo commented Dec 9, 2015

@Jamoke thanks :)
Yes, I did. I even disabled progard and failed with no locks.

@ShihabSoft
Copy link

Hope you got the correct dependencies in libs folder and try Project->Clean

Regards,
ShihabSoft
Founder of RevealedTricks4U http://www.revealedtricks4u.com

@ShihabSoft
Copy link

You've been invited to join HelloFax by spk674@gmail.com. HelloFax lets you send and receive faxes from the browser. Join now and we'll both get 5 free fax pages.

Accept invitation: https://www.hellofax.com/?ref=c1f8cdb2&amp%3Bs=F&utm_campaign=friend_invite&utm_source=default&utm_medium=email&utm_content=original

Thanks for going paperless!

The HelloFax Team

@lkevin029
Copy link

try to change your classpath to classpath 'com.android.tools.build:gradle:1.2.3'
then clean and rebuild its in build.gradle (project: ) file
the classpath of this example https://github.com/bytedeco/sample-projects/blob/master/JavaCV-android-example/build.gradle use classpath 'com.android.tools.build:gradle:1.2.3'

@vxhviet
Copy link

vxhviet commented May 24, 2016

@Jamoke would you mind providing the steps to get this working? I've literally trying every possible methods provided but still haven't managed to get this working :'(

@saudet
Copy link
Member

saudet commented Jan 18, 2018

@Jamoke Could you update the instructions on the wiki page with your findings?
Thanks a lot for testing this out!

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

No branches or pull requests