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

Caused by: java.lang.NoClassDefFoundError: java.lang.ClassNotFoundException: org.bytedeco.javacpp.avutil #52

Closed
a610569731 opened this issue May 9, 2015 · 45 comments

Comments

@a610569731
Copy link

Part of the mobile phone will appear android SDK :15

    AndroidRuntime   java.lang.ExceptionInInitializerError
#8765   05-09 21:52:17.710  12329   E   AndroidRuntime           at com.qd.recorder.FFmpegFrameRecorder.(FFmpegFrameRecorder.java:179)
#8766   05-09 21:52:17.710  12329   E   AndroidRuntime           at com.qd.recorder.RecordActivity2.initRecorder(RecordActivity2.java:314)
#8767   05-09 21:52:17.710  12329   E   AndroidRuntime           at com.qd.recorder.RecordActivity2.startRecording(RecordActivity2.java:346)
#8768   05-09 21:52:17.710  12329   E   AndroidRuntime           at com.qd.recorder.RecordActivity2.initLayout(RecordActivity2.java:288)
#8769   05-09 21:52:17.710  12329   E   AndroidRuntime           at com.qd.recorder.RecordActivity2.onCreate(RecordActivity2.java:182)
#8770   05-09 21:52:17.710  12329   E   AndroidRuntime           at android.app.Activity.performCreate(Activity.java:4470)
#8771   05-09 21:52:17.710  12329   E   AndroidRuntime           at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
#8772   05-09 21:52:17.710  12329   E   AndroidRuntime           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1929)
#8773   05-09 21:52:17.710  12329   E   AndroidRuntime           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1990)
#8774   05-09 21:52:17.710  12329   E   AndroidRuntime           at android.app.ActivityThread.access$600(ActivityThread.java:124)
#8775   05-09 21:52:17.710  12329   E   AndroidRuntime           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1148)
#8776   05-09 21:52:17.710  12329   E   AndroidRuntime           at android.os.Handler.dispatchMessage(Handler.java:99)
#8777   05-09 21:52:17.710  12329   E   AndroidRuntime           at android.os.Looper.loop(Looper.java:137)
#8778   05-09 21:52:17.710  12329   E   AndroidRuntime           at android.app.ActivityThread.main(ActivityThread.java:4451)
#8779   05-09 21:52:17.710  12329   E   AndroidRuntime           at java.lang.reflect.Method.invokeNative(Native Method)
#8780   05-09 21:52:17.710  12329   E   AndroidRuntime           at java.lang.reflect.Method.invoke(Method.java:511)
#8781   05-09 21:52:17.710  12329   E   AndroidRuntime           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:788)
#8782   05-09 21:52:17.710  12329   E   AndroidRuntime           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
#8783   05-09 21:52:17.710  12329   E   AndroidRuntime           at dalvik.system.NativeStart.main(Native Method)
#8784   05-09 21:52:17.710  12329   E   AndroidRuntime   Caused by: java.lang.NoClassDefFoundError: java.lang.ClassNotFoundException: org.bytedeco.javacpp.avutil
#8785   05-09 21:52:17.710  12329   E   AndroidRuntime           at org.bytedeco.javacpp.Loader.load(Loader.java:388)
#8786   05-09 21:52:17.710  12329   E   AndroidRuntime           at org.bytedeco.javacpp.Loader.load(Loader.java:354)
#8787   05-09 21:52:17.710  12329   E   AndroidRuntime           at org.bytedeco.javacpp.avcodec$AVPacket.(avcodec.java:1405)
#8788   05-09 21:52:17.710  12329   E   AndroidRuntime           ... 19 more
#8789   05-09 21:52:17.710  12329   E   AndroidRuntime   Caused by: java.lang.ClassNotFoundException: org.bytedeco.javacpp.avutil
#8790   05-09 21:52:17.710  12329   E   AndroidRuntime           at java.lang.Class.classForName(Native Method)
#8791   05-09 21:52:17.710  12329   E   AndroidRuntime           at java.lang.Class.forName(Class.java:217)
#8792   05-09 21:52:17.710  12329   E   AndroidRuntime           at org.bytedeco.javacpp.Loader.load(Loader.java:386)
#8793   05-09 21:52:17.710  12329   E   AndroidRuntime           ... 21 more
#8794   05-09 21:52:17.710  12329   E   AndroidRuntime   Caused by: java.lang.NoClassDefFoundError: org/bytedeco/javacpp/avutil
#8795   05-09 21:52:17.710  12329   E   AndroidRuntime           ... 24 more
#8796   05-09 21:52:17.710  12329   E   AndroidRuntime   Caused by: java.lang.ClassNotFoundException: org.bytedeco.javacpp.avutil
#8797   05-09 21:52:17.710  12329   E   AndroidRuntime           at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
#8798   05-09 21:52:17.710  12329   E   AndroidRuntime           at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
#8799   05-09 21:52:17.710  12329   E   AndroidRuntime           at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
#8800   05-09 21:52:17.710  12329   E   AndroidRuntime           ... 24 more
@saudet
Copy link
Member

saudet commented May 10, 2015

Please try to follow the instructions here:
https://github.com/bytedeco/javacpp-presets/#manual-installation

@a610569731
Copy link
Author

Ask how to solve

@saudet
Copy link
Member

saudet commented May 10, 2015

Following the installation instructions should solve this issue. If they do not, then please provide more information about your device, etc.

@a610569731
Copy link
Author

x86 and arm
Or java.lang.ClassNotFoundException: org.bytedeco.javacpp.avutil

MTK MT6732 ARMv8

@a610569731
Copy link
Author

I need your help on the line app

@saudet
Copy link
Member

saudet commented May 10, 2015

Maybe it has something to do with ProGuard:
https://github.com/bytedeco/javacv/wiki/Configuring-Proguard-for-JavaCV

@a610569731
Copy link
Author

NO ProGuard Can compile android arm64-v8a javacv-bin linux-x86_64 libavformat.so.56 android Not recognized

@a610569731
Copy link
Author

dlopen("/data/app-lib/com.qd.videorecorder-1/libjniavutil.so") failed: dlopen failed: cannot locate symbol "av_fopen_utf8" referenced by "libjniavutil.so"...

@saudet
Copy link
Member

saudet commented May 10, 2015

So you need ARM 64-bit binaries? Could you provide the necessary changes for that? It would help a lot, thanks!

@a610569731
Copy link
Author

build error [ERROR] Failed to execute JavaCPP Builder: Could not parse "libavutil/avutil.h": File does not exist ubantu 64 How to compile

@saudet
Copy link
Member

saudet commented May 11, 2015

You're going to need to modify and run cppbuild.sh too:
https://github.com/bytedeco/javacpp-presets#cppbuild-scripts
And also add a new android-arm64 or something platform to JavaCPP:
https://github.com/bytedeco/javacpp/tree/master/src/main/resources/org/bytedeco/javacpp/properties

@saudet
Copy link
Member

saudet commented Jul 17, 2015

Could you try again with version 1.0 and let me know if you get the same error? Thanks!

@arvind-das
Copy link

Hi Saudet, I am getting the same error. I am on version 1.0

Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.bytedeco.javacpp.avutil
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:270)
    at org.bytedeco.javacpp.Loader.load(Loader.java:390)
    at org.bytedeco.javacpp.Loader.load(Loader.java:358)
    at org.bytedeco.javacpp.avformat$AVFormatContext.<clinit>(avformat.java:2539)
    at com.rrdtech.recorder.javacv.FFmpegFrameGrabber.startUnsafe(FFmpegFrameGrabber.java:381)
    at com.rrdtech.recorder.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:375)
    at com.rrdtech.recorder.javacv.CustomFFmpegFileSystemRecorder.startRecord(CustomFFmpegFileSystemRecorder.java:49)
    at com.rrdtech.api.reordingapp.App.main(App.java:17)

Running on Raspberry Pi 2 with ubuntu installed on it.

Any ideas ?
Thanks!

@saudet
Copy link
Member

saudet commented Sep 26, 2015

@arvind-das see issue #37

@arvind-das
Copy link

Thanks but no success here, looks like I need to spend more time one this as this seems to be the issue with most people. Will not make hurry now. After setting up, presets and installing opencv correctly , on building javacv, getting this error:

[ERROR] Failed to execute goal on project javacv: Could not resolve dependencies for project org.bytedeco:javacv:jar:1.0: The following artifacts could not be resolved: org.bytedeco.javacpp-presets:ffmpeg:jar:linux-arm:2.7.1-1.0, org.bytedeco.javacpp-presets:flycapture:jar:linux-arm:2.7.3.19-1.0, org.bytedeco.javacpp-presets:libdc1394:jar:linux-arm:2.2.3-1.0, org.bytedeco.javacpp-presets:libfreenect:jar:linux-arm:0.5.2-1.0, org.bytedeco.javacpp-presets:videoinput:jar:linux-arm:0.200-1.0, org.bytedeco.javacpp-presets:artoolkitplus:jar:linux-arm:2.3.1-1.0, org.bytedeco.javacpp-presets:opencv:jar:linux-arm:3.0.0-1.0, org.bytedeco.javacpp-presets:flandmark:jar:linux-arm:1.07-1.0: Failure to find org.bytedeco.javacpp-presets:ffmpeg:jar:linux-arm:2.7.1-1.0 in http://repo.maven.apache.org/maven2

Also, please let me know which jar should have org.bytedeco.javacpp.avutil class.!

@arvind-das
Copy link

Hi @saudet , I successfully installed javacpp-presets. OpenCV-3.0.0 and javacv 1.0. The newly generated ffmpeg and other packages on the raspberry pi now contains above missing class "org.bytedeco.javacpp.avutil" . Here is the link to all those generated files residing in my pi's local mvn folder .m2 .
link to files!

But javacv 1.0 is still not building saying the above error that it could not find dependencies .
example_screenshot

Please note: my raspberry pi is running ubuntu 14.04. I will post out a complete blog on this to make sure things work with others too but I need to run my first. :)
Cheers!

@saudet
Copy link
Member

saudet commented Oct 3, 2015

There's still no file named ffmpeg-2.7.1-1.0-linux-arm.jar! You need a file named ffmpeg-2.7.1-1.0-linux-arm.jar.

@arvind-das
Copy link

Okay, but isn't it that, required class files should be present in the jars for supporting execution. So what I did is, copied >ffmpeg-2.7.1-1.0.jar to >ffmpeg-2.7.1-1.0-linux-arm.jar which makes it present there and javacv build on pi is a success , but the problem remains same,

java.lang.NoClassDefFoundError: Could not initialize class org.bytedeco.javacpp.avutil

Please help me out!

@saudet
Copy link
Member

saudet commented Oct 4, 2015

@arvind-das No that's not going to work. Like I said, see issue #37.

@arvind-das
Copy link

@saudet Okay, but that is not helping either, I am not sure why these files are not getting generated even if everything compiled correctly. Looks like its time to Yoga, take a fresh breathe and come back for me. :)

@saudet
Copy link
Member

saudet commented Oct 4, 2015

@arvind-das Ok, so what do your modifications to the cppbuild.sh file look like?

@arvind-das
Copy link

    linux-x86)
        CC="gcc -m32" CXX="g++ -m32" $CMAKE -DCMAKE_INSTALL_PREFIX=.. -DENABLE_SSE3=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_JASPER=ON -DBUILD_JPEG=ON -DBUILD_WEBP=ON -DBUILD_OPENEXR=ON -DBUILD_PNG=ON -DBUILD_TIFF=ON -DBUILD_ZLIB=ON -DBUILD_opencv_java=OFF -DBUILD_opencv_python2=OFF -DENABLE_PRECOMPILED_HEADERS=OFF -DWITH_1394=OFF -DWITH_FFMPEG=OFF -DWITH_GSTREAMER=OFF -DWITH_OPENMP=ON -DWITH_CUDA=OFF -DWITH_OPENCL=OFF -DWITH_IPP=OFF # -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-$OPENCV_VERSION/modules
        make -j4
        make install/strip
        ;;
    linux-arm)
        CC="gcc -m32" CXX="g++ -m32" $CMAKE -DCMAKE_INSTALL_PREFIX=.. -DENABLE_SSE3=OFF -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_JASP$
        make -j4
        make install/strip
        ;;

    linux-x86_64)
        CC="gcc -m64" CXX="g++ -m64" $CMAKE -DCMAKE_INSTALL_PREFIX=.. -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_JASPER=ON -DBUILD_JPEG=ON -DBUILD_WEBP=ON -DBUILD_OPENEXR=ON -DBUILD_PNG=ON -DBUILD_TIFF=ON -DBUILD_ZLIB=ON -DBUILD_opencv_java=OFF -DBUILD_opencv_python2=OFF -DENABLE_PRECOMPILED_HEADERS=OFF -DWITH_1394=OFF -DWITH_FFMPEG=OFF -DWITH_GSTREAMER=OFF -DWITH_OPENMP=ON -DWITH_CUDA=OFF -DWITH_OPENCL=OFF -DWITH_IPP=OFF # -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-$OPENCV_VERSION/modules
        make -j4
        make install/strip
        ;;

@saudet
Copy link
Member

saudet commented Oct 4, 2015

That's for OpenCV. You're trying to use FFmpeg. You need to do the same for FFmpeg's cppbuild.sh script file.

@arvind-das
Copy link

Oops! my bad, will do that right away, I thought I just need to fix with opencv , platform for rest will be detected automatically.

@saudet
Copy link
Member

saudet commented Oct 12, 2015

If anyone would like to work on binaries for the android-arm64 platform, please let me know! Thank you

@arvind-das
Copy link

I am gaining some speed with installing cross tool compiler, no success yet but I can see the sun. Will update once my installation is done.
https://trac.ffmpeg.org/wiki/CompilationGuide/RaspberryPi

@pradeep2929
Copy link

I am getting crash in Android 5.1, Native platform armeabi-v7a, CPU model MSM8916. The model suggests it should support 32 bit .so files. But it crashes. I downloaded the most recent javacpp release, it has armeabi support only. Is there a release package available for download for 64bit chips?

java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil
at org.bytedeco.javacv.FFmpegFrameFilter.startUnsafe(FFmpegFrameFilter.java:158)
at org.bytedeco.javacv.FFmpegFrameFilter.start(FFmpegFrameFilter.java:154)

@ghost
Copy link

ghost commented Dec 7, 2016

Could not build android project:
Task:

:app:compileDevelopDebugJavaWithJavac

Error:

error: cannot access avutil
recorder.record(yuvImage);
^
class file for org.bytedeco.javacpp.avutil not found

App config:

androidBuildToolsVersion = "25.0.1"
androidMinSdkVersion = 19
androidTargetSdkVersion = 25
androidCompileSdkVersion = 25

compile project(':openCVLibrary310')

compile files('libs/javacv-1.2.jar')
compile files('libs/javacpp-1.2.7.jar')
compile files('libs/opencv-3.1.0-1.2-android-arm.jar')
compile files('libs/opencv-3.1.0-1.2-android-x86.jar')
compile files('libs/ffmpeg-3.1.2-1.2-android-arm.jar')
compile files('libs/ffmpeg-3.1.2-1.2-android-x86.jar')

@saudet
Copy link
Member

saudet commented Dec 7, 2016

@viettanbkdn You forgot to include:

compile files('libs/opencv-3.1.0-1.2.jar')
compile files('libs/ffmpeg-3.1.2-1.2.jar')

@ghost
Copy link

ghost commented Dec 7, 2016

@saudet sorry but how can I fixed the issue:

"xxx" is 32-bit instead of 64-bit

Tried to find the solution but got nothing. Could you please help me?

@saudet
Copy link
Member

saudet commented Dec 7, 2016

@viettanbkdn It looks like for some reason you need 64-bit binaries. There isn't currently a build for that. Someone needs to work on that. If you could help with doing that, it would be great! Contributions are welcome.

@nickbernz
Copy link

Salut,

As per today, what is the status with ffmpeg and arm64. I definitly needs them and how could I help?

merci

@saudet
Copy link
Member

saudet commented Feb 21, 2017

@nickbernz Help is welcome!

@rubi-sharma
Copy link

I need help to build .so files for android-arm64.

saudet added a commit that referenced this issue Feb 25, 2018
@saudet
Copy link
Member

saudet commented Feb 27, 2018

64-bit builds for Android (as the "android-arm64" and "android-x86_64" platforms) are now available, so please give it a try! Binaries for 1.4.1-SNAPSHOT can be downloaded from the snapshot repository: http://bytedeco.org/builds/

@saudet
Copy link
Member

saudet commented Apr 9, 2018

Artifacts have now been released as version 1.4.1. Enjoy and thanks for your patience!

@saudet saudet closed this as completed Apr 9, 2018
@girishnr1
Copy link

I have downloaded all the .jar files and configured Eclipse project to uses DL4J.
I'm getting below exception when loading previously saved model. Please help.
java.lang.NoClassDefFoundError: org/bytedeco/javacpp/hdf5$DataType

Code snippet:
String simpleMlp = new ClassPathResource("mymodel.h5").getFile().getPath();
KerasModelImport.importKerasSequentialModelAndWeights

@saudet
Copy link
Member

saudet commented Jan 23, 2019

@girishnr1 HDF5 isn't supported on Android.

@girishnr1
Copy link

The error is on windows machine ( windows 7).
DL4J is setup using instructions under:
https://deeplearning4j.org/docs/latest/deeplearning4j-quickstart
I see that javacpp-1.3.1.jar, Is there an updated version that supports hdf5?

@saudet
Copy link
Member

saudet commented Jan 24, 2019

@girishnr1 Please upgrade to the latest version, and if you're still having problems, please ask on the support channels of Deeplearning4j, not here.

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

9 participants