Open lansedebing opened 9 years ago
@sethshal Of course it matters. Please ask the Android team for information regarding your native platform, and let us know what you find! Thanks
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'
}
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)
@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
@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)
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.
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.
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.
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])
@Jamoke thanks :) Yes, I did. I even disabled progard and failed with no locks.
Hope you got the correct dependencies in libs folder and try Project->Clean
Regards, ShihabSoft Founder of RevealedTricks4U http://www.revealedtricks4u.com
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&%3Bs=F&utm_campaign=friend_invite&utm_source=default&utm_medium=email&utm_content=original
Thanks for going paperless!
The HelloFax Team
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'
@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 :'(
@Jamoke Could you update the instructions on the wiki page with your findings? Thanks a lot for testing this out!