Open lansedebing opened 9 years ago
Please try to follow the instructions here: https://github.com/bytedeco/javacv
It is still can not work, can you tell me which improtant step I may have ignored。
Please explain in detail what you are doing.
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
Don't do that. Please try to follow the instructions here: https://github.com/bytedeco/javacv#manual-installation
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.
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.
ok,thank you very much
When i used Android Studio ,I got "java.lang.NoClassDefFoundError: org/bytedeco/javacpp/avcodec$AVPacket"
Which JAR files are you using and how did you add them?
I added javacv.jar javacpp.jar ffmpeg.jar opencv.jar iffmpeg-android-arm.jar and opencv-android-arm.jar into libs
And which ones are in the dependencies list?
all
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?
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 ?
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.
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.
Does this still happen with version 0.11?
I tried with version 0.11 too and I run into the same problem
@sethshal Could you provide more details about what is happening? I'm not getting any errors or warnings here. Thanks!
Do you want the gradle build output without the -dontwarn? Or the log file when compiled with the -dontwarn and executed?
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
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 https://github.com/bytedeco/javacv/issues/79#issuecomment-90937956.
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)
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!
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.
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!!
Thanks for checking up on this. I had tried the link on google groups too earlier. I had also tried to exclude the javacv.jar and javacpp.jar from program obfuscation too. Neither option worked.
I will gladly create a page once we have figured out what is happening. It will help people out.
On Sun, Apr 12, 2015 at 9:50 AM, Samuel Audet notifications@github.com wrote:
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!!
— Reply to this email directly or view it on GitHub https://github.com/bytedeco/javacv/issues/79#issuecomment-92065067.
I get a java.lang.NoClassDefFoundError: org.bytedeco.javacv.CameraDevice$SettingsImplementation'
error when starting my app. Do you think this is related? I built in debug mode rather than release, so I am not sure proguard is enabled in that.
Alright, I've written a wiki page on proguard settings which can be found here: https://github.com/bytedeco/javacv/wiki/Configuring-Proguard-for-JavaCV
This should fix the issues mentioned in #79, #127, #133, #65 , #142 and possibly even #139 might be related.
@lfdversluis Awesome! :+1: Thanks a lot! Let's wait and see if that works for everyone.
Lauren's Thanks for creating the Wiki page. I did try your settings. The solution fixes the problem, but it works the same as disabling Proguard. How big is your app size? My app size without these libraries in a little over 2MB and with these settings it is close to 90MB and the same with disabling Proguard.
On Sat, May 9, 2015 at 6:15 AM, Samuel Audet notifications@github.com wrote:
@lfdversluis https://github.com/lfdversluis Awesome! [image: :+1:] Thanks a lot! Let's wait and see if that works for everyone.
— Reply to this email directly or view it on GitHub https://github.com/bytedeco/javacv/issues/79#issuecomment-100459314.
@sethshal you might want to experiment with the proguard rules to see which ones you can remove (just put them in comment and build your app). Also, for me javacv is/will be part of a bigger app, so proguard still shrinks and optimizes other parts, except javacv. My app is currently 39.5MB with those settings, so I don't understand why yours is anything bigger than that if it's a minimal example.
What does your proguard rules file look like? What version of proguard are you using? I am using 5.2.1 and the project works with just these two lines in the proguard file. But my project size is 85 MB
-dontwarn org.bytedeco.javacv. -dontwarn org.bytedeco.javacpp.
On Mon, May 11, 2015 at 9:34 AM, Laurens Versluis notifications@github.com wrote:
@sethshal https://github.com/sethshal you might want to experiment with the proguard rules to see which ones you can remove (just put them in comment and build your app). Also, for me javacv is/will be part of a bigger app, so proguard still shrinks and optimizes other parts, except javacv. My app is currently 39.5MB with those settings, so I don't understand why yours is anything bigger than that if it's a minimal example.
— Reply to this email directly or view it on GitHub https://github.com/bytedeco/javacv/issues/79#issuecomment-100908788.
@sethshal which "these two lines" do you mean? I currently use this:
-keepattributes *Annotation*
# JavaCV
-keep @org.bytedeco.javacpp.annotation interface * {
*;
}
-keep @org.bytedeco.javacpp.annotation.Platform public class *
#-keepclasseswithmembernames class * {
# @org.bytedeco.* <fields>;
#}
#-keepclasseswithmembernames class * {
# @org.bytedeco.* <methods>;
#}
#-keepattributes EnclosingMethod
-keep @interface org.bytedeco.javacpp.annotation.*,javax.inject.*
-keepattributes *Annotation*, Exceptions, Signature, Deprecated, SourceFile, SourceDir, LineNumberTable, LocalVariableTable, LocalVariableTypeTable, Synthetic, EnclosingMethod, RuntimeVisibleAnnotations, RuntimeInvisibleAnnotations, RuntimeVisibleParameterAnnotations, RuntimeInvisibleParameterAnnotations, AnnotationDefault, InnerClasses
-keep class org.bytedeco.javacpp.** {*;}
-dontwarn java.awt.**
-dontwarn org.bytedeco.javacv.**
-dontwarn org.bytedeco.javacpp.**
# end javacv
and that seems to work. (note that two items are in comment). I haven't tried disabling more settings, but check what this does for you.
-dontwarn org.bytedeco.javacv. -dontwarn org.bytedeco.javacpp.
On Tue, May 12, 2015 at 5:25 AM, Laurens Versluis notifications@github.com wrote:
@sethshal https://github.com/sethshal which "these two lines" do you mean? I currently use this:
-keepattributes Annotation
JavaCV
-keep @org.bytedeco.javacpp.annotation interface * { *; }
-keep @org.bytedeco.javacpp.annotation.Platform public class *
-keepclasseswithmembernames class * {
@org.bytedeco.*
; }
-keepclasseswithmembernames class * {
@org.bytedeco.*
; }
-keepattributes EnclosingMethod
-keep @interface org.bytedeco.javacpp.annotation.,javax.inject.
-keepattributes Annotation, Exceptions, Signature, Deprecated, SourceFile, SourceDir, LineNumberTable, LocalVariableTable, LocalVariableTypeTable, Synthetic, EnclosingMethod, RuntimeVisibleAnnotations, RuntimeInvisibleAnnotations, RuntimeVisibleParameterAnnotations, RuntimeInvisibleParameterAnnotations, AnnotationDefault, InnerClasses -keep class org.bytedeco.javacpp.* {;} -dontwarn java.awt. -dontwarn org.bytedeco.javacv. -dontwarn org.bytedeco.javacpp.
end javacv
and that seems to work. (note that two items are in comment). I haven't tried disabling more settings, but check what this does for you.
— Reply to this email directly or view it on GitHub https://github.com/bytedeco/javacv/issues/79#issuecomment-101210275.
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.
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 https://github.com/bytedeco/javacv/issues/79#issuecomment-101292310.
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'
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 https://github.com/bytedeco/javacv/issues/79#issuecomment-101305153.
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
@semiromid Please try again with version 0.11
Ок
@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!
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 https://github.com/bytedeco/javacv/issues/79#issuecomment-105314202.
@sethshal Try to strip them out one by one, and put back those without which your app doesn't work :)
@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?
@saudet Does it matter where I copy the .so files?