Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

567
Visualizações
java.lang.NoClassDefFoundError: Could not initialize class org.bytedeco.javacpp.avutil

I am using Windows10, eclipse-neon with JDK1.8 version, I am getting the following exception.

Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.bytedeco.javacpp.avutil
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.bytedeco.javacpp.Loader.load(Loader.java:385)
at org.bytedeco.javacpp.Loader.load(Loader.java:353)
at org.bytedeco.javacpp.avformat$AVFormatContext.<clinit>(avformat.java:2719)
at org.bytedeco.javacv.FFmpegFrameGrabber.startUnsafe(FFmpegFrameGrabber.java:391)
at org.bytedeco.javacv.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:385)
at com.segment.processor.AudioMain.main(ApacheMathAudioMain.java:20)
Error getting static method ID of org/bytedeco/javacpp/Loader/putMemberOffset

here are the dependencies I am using in my pom.xml

    <dependency>
        <groupId>org.bytedeco</groupId>
        <artifactId>javacv</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>org.bytedeco.javacpp-presets</groupId>
        <artifactId>ffmpeg</artifactId>
        <version>3.0.2-1.2</version>
    </dependency>

    <dependency>
        <groupId>org.bytedeco.javacpp-presets</groupId>
        <artifactId>opencv</artifactId>
        <version>3.1.0-1.2</version>
    </dependency>

    <dependency>
        <groupId>org.bytedeco</groupId>
        <artifactId>javacpp</artifactId>
        <version>0.10</version>
    </dependency>
about 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

First problem

Your versions don't match. org.bytedeco.javacpp in version 0.10 is from Dec 2014, while all your other versions are from May 2016. You need to use version 1.2 of org.bytedeco.javacpp, or better yet, update all dependencies to the latest version.

You can see the versions here:

org.bytedeco.javacpp-presets » opencv

org.bytedeco.javacpp-presets » ffmpeg

org.bytedeco » javacv

org.bytedeco » javacpp

Second problem

You include the dependencies for Java code only, but you don't include the dependencies for native code (both opencv and ffmpeg are native libraries). You need to include opencv-platform and ffmpeg-platform instead:

<dependency>
    <groupId>org.bytedeco</groupId>
    <artifactId>javacpp</artifactId>
    <version>1.4.1</version>
</dependency>
<dependency>
    <groupId>org.bytedeco</groupId>
    <artifactId>javacv</artifactId>
    <version>1.4.1</version>
</dependency>
<dependency>
    <groupId>org.bytedeco.javacpp-presets</groupId>
    <artifactId>opencv-platform</artifactId>
    <version>3.4.1-1.4.1</version>
</dependency>
<dependency>
    <groupId>org.bytedeco.javacpp-presets</groupId>
    <artifactId>ffmpeg-platform</artifactId>
    <version>3.4.2-1.4.1</version>
</dependency>

This will make Maven download and include opencv and ffmpeg libraries for Android, Linux, MacOS and Windows, both x86 and x64.

about 4 years ago · Santiago Trujillo Relatório

0

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

Actual cause of error is different versions of dependencies. That's why javacpp package failed during mapping of classes.

Follow these step to resolve this problem:

  • Download latest version of Javacv library package from here
  • Copy these three .jar files into libs folder

    • ffmpeg.jar
    • javacv.jar
    • javacpp.jar
  • Create jniLibs folder in app\src\main

  • Now, create four different folders for different architectures

    • arm64-v8a
    • armeabi
    • armeabi-v7a
    • x86
  • Change extension of these two files ffmpeg-android-arm.jar, ffmpeg-android-x86.jar to .zip then unzip both folders and Copy .so files for each architecture and paste in its respected directory. Your resultant directory should be look like this

  • List item

  • Add .jar dependencies in your gradle file as follows:

    implementation files('libs/ffmpeg.jar')
    implementation files('libs/javacpp.jar')
    implementation files('libs/javacv.jar')```
    

Thanks for reading :)

about 4 years ago · Santiago Trujillo Relatório

0

Try to update the dependencies with the latest versions and check whether class exists in that or not

https://mvnrepository.com/artifact/org.bytedeco/javacv/1.4.1 https://mvnrepository.com/artifact/org.bytedeco.javacpp-presets/ffmpeg/3.4.2-1.4.1 https://mvnrepository.com/artifact/org.bytedeco.javacpp-presets/opencv/3.4.1-1.4.1

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda