K
K
Konstantin Berkov2015-07-12 02:24:00
Java
Konstantin Berkov, 2015-07-12 02:24:00

How to include precompiled native libraries in Android Studio?

Following the advice from the article Do not use the standard MediaPlayer , I decided to use one of the ready-made libraries for playing based on FFmpeg - wseemann/FFmpegMediaPlayer .
Following the instructions "Extract and copy the following JAR file and prebuilt native libraries into your projects "libs" folder" without hesitation, I placed the indicated files in the libs folder and added dependency to the jar, as a result, when I try to create an FFmpegMediaPlayer object, I get the following beauty:
07- 11 23:12:26.658 4579-4579/"my_package".debug E/dalvikvm﹕ ERROR: couldn't find native method
07-11 23:12:26.658 4579-4579/"my_package".debug E/dalvikvm﹕ Requested: Lwseemann/media/FFmpegMediaPlayer;.native_getMetadata:
07-11 23:12:26.658 4579-4579/"my_package".debug E/dalvikvm﹕ Candidate: Lwseemann/media/FFmpegMediaPlayer;.native_getMetadata:(ZZLjava/util/HashMap;)Ljava/util/HashMap;
07-11 23:12:26.658 4579-4579/"my_package".debug W/dalvikvm﹕ No implementation found for native Lwseemann/media/FFmpegMediaPlayer;.native_init:()V
07-11 23:12:26.658 4579-4579/ "my_package".debug W/dalvikvm﹕ Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lwseemann/media/FFmpegMediaPlayer;
And actually the root of evil: java.lang.UnsatisfiedLinkError: Native method not found: wseemann.media.FFmpegMediaPlayer.native_init:()V

But I didn’t stop there and decided to use fmp-demo from the same project, importing the project with the help of the studio, I got a demo project that is quite going to itself, which surprised me, because this is the jniLibs folder next to the java and res folder, it actually contains there were *.so for different architectures. Inspired by this discovery, I tried to do the same with my project, the result is exactly the same error.

Actually I'm interested in whether someone had similar problems and how they were solved, except for how they compiled the necessary libraries at home.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Berkov, 2015-07-21
@konstantin_berkow

In total, everything was solved trivially - I moved the folders with *.so files to the jniLibs folder in the main folder.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question