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

Include in cordova project #27

Closed
gen-failure opened this issue Oct 23, 2014 · 7 comments
Closed

Include in cordova project #27

gen-failure opened this issue Oct 23, 2014 · 7 comments

Comments

@gen-failure
Copy link

Hi,

I tried to include the library to cordova project, but it's failing on this error :

E/FFmpegMediaMetadataRetriever(20120): FFmpegMediaMetadataRetriever libraries not found. Did you forget to add them to your libs folder?
W/dalvikvm(20120): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lwseemann/media/FFmpegMediaMetadataRetriever;
W/System.err(20120): java.lang.UnsatisfiedLinkError

I tried to compile by myself and printed out the list of browsed directories

D/SEARCHLIB(20120): /data/data/dalvik
D/SEARCHLIB(20120): /data/data/dalvik.system
D/SEARCHLIB(20120): /data/data/dalvik.system.VMStack
D/SEARCHLIB(20120): /data/data/java
D/SEARCHLIB(20120): /data/data/java.lang
D/SEARCHLIB(20120): /data/data/java.lang.Thread
D/SEARCHLIB(20120): /data/data/wseemann
D/SEARCHLIB(20120): /data/data/wseemann.media
D/SEARCHLIB(20120): /data/data/wseemann.media.FFmpegMediaMetadataRetriever
D/SEARCHLIB(20120): /data/data/de
D/SEARCHLIB(20120): /data/data/de.michael_bln
D/SEARCHLIB(20120): /data/data/de.michael_bln.capture_thumb
D/SEARCHLIB(20120): /data/data/de.michael_bln.capture_thumb.CaptureThumb
D/SEARCHLIB(20120): /data/data/org
D/SEARCHLIB(20120): /data/data/org.apache
D/SEARCHLIB(20120): /data/data/org.apache.cordova
D/SEARCHLIB(20120): /data/data/org.apache.cordova.CordovaPlugin
D/SEARCHLIB(20120): /data/data/org
D/SEARCHLIB(20120): /data/data/org.apache
D/CordovaLog(20120): file:///android_asset/www/js/gifMaker.js: Line 71 : 0
D/SEARCHLIB(20120): /data/data/org.apache.cordova
D/SEARCHLIB(20120): /data/data/org.apache.cordova.PluginManager
D/SEARCHLIB(20120): /data/data/org
D/SEARCHLIB(20120): /data/data/org.apache
D/SEARCHLIB(20120): /data/data/org.apache.cordova
D/SEARCHLIB(20120): /data/data/org.apache.cordova.PluginManager
D/SEARCHLIB(20120): /data/data/org
D/SEARCHLIB(20120): /data/data/org.apache
D/SEARCHLIB(20120): /data/data/org.apache.cordova
D/SEARCHLIB(20120): /data/data/org.apache.cordova.ExposedJsApi
D/SEARCHLIB(20120): /data/data/com
D/SEARCHLIB(20120): /data/data/com.android
D/SEARCHLIB(20120): /data/data/com.android.org
D/SEARCHLIB(20120): /data/data/com.android.org.chromium
D/SEARCHLIB(20120): /data/data/com.android.org.chromium.base
D/SEARCHLIB(20120): /data/data/com.android.org.chromium.base.SystemMessageHandler
D/SEARCHLIB(20120): /data/data/com
D/SEARCHLIB(20120): /data/data/com.android
D/SEARCHLIB(20120): /data/data/com.android.org
D/SEARCHLIB(20120): /data/data/com.android.org.chromium
D/SEARCHLIB(20120): /data/data/com.android.org.chromium.base
D/SEARCHLIB(20120): /data/data/com.android.org.chromium.base.SystemMessageHandler
D/SEARCHLIB(20120): /data/data/android
D/SEARCHLIB(20120): /data/data/android.os
D/SEARCHLIB(20120): /data/data/android.os.Handler
D/SEARCHLIB(20120): /data/data/android
D/SEARCHLIB(20120): /data/data/android.os
D/SEARCHLIB(20120): /data/data/android.os.Looper
D/SEARCHLIB(20120): /data/data/android
D/SEARCHLIB(20120): /data/data/android.os
D/SEARCHLIB(20120): /data/data/android.os.HandlerThread

When I open .apk file the libs directory is present.

I will be very grateful for any help

@wseemann
Copy link
Owner

Can you send along an APK or the app source code?

@gen-failure
Copy link
Author

I sent you apk file

@gen-failure
Copy link
Author

I know that cordova has it's own building mechanism based on ant, so maybe some attribute is simply missing.

@gen-failure
Copy link
Author

This actually helped me and it's not cordova related issue, maybe it will help others as well

I found the solution, it's still dirty, but works

100 /FIXME
101 if (!foundLibs) {
102 Log.e(TAG, TAG + " libraries not found. Did you forget to add them to your libs folder?");
103 throw new UnsatisfiedLinkError();
104 }
105
106 for (int i = 0; i < JNI_LIBRARIES.length; i++) {
107 System.load(path.toString() + JNI_LIBRARIES[i]);
108 }/
109 $
110 System.loadLibrary("avutil");
111 System.loadLibrary("swscale");
112 System.loadLibrary("avcodec");
113 System.loadLibrary("avformat");
114 System.loadLibrary("ffmpeg_mediametadataretriever_jni");
11
116 native_init();
117 }

@wseemann
Copy link
Owner

Back when I used to compile FFmpeg with a soname prefix I need to load each library using the explicit path. Since I no longer use the prefix System.loadLibrary(...) seems to work fine. I've modified the code to use the proposed approach. Thank you for the bug report.

@gen-failure
Copy link
Author

actually, it would be cool to have access to full ffmpeg binary but "/data/data" is probably not reliable way to reach it :)

@wseemann
Copy link
Owner

There are other projects that can build that binary (https://github.com/guardianproject/android-ffmpeg). A full binary wouldn't really make sense for this library so I won't provide one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants