Hi all,
Have almost same issue:
Need to implement Android application that should play Animated webp files inside it.
While searching I have not found any simple solutions, here are options that I have:
1. fresco facebook library has animatd webp support, but it is extra huge +3.5MB in apk and it looks like overkill for simple task of webm playing. (
http://frescolib.org/)
2. Compile webp library by my self and integrate it with my android app.
Now I am trying to start framesequence Sample working. And I have some trouble with it.
Want to say sorry for a long story in advance, because I am not familiar with Andorid.mk files and native source code compilation.
Here are log of my actions and it's results.
.../ex/framesequence$ ant debug
[exec] jni/FrameSequence_gif.h:20:20: fatal error: config.h: No such file or directory
[exec] #include "config.h"
Error happens, this issue was resolved in discussion.
[exec] In file included from jni/FrameSequence_gif.cpp:22:0:
[exec] jni/FrameSequence_gif.h:21:21: fatal error: gif_lib.h: No such file or directory
[exec] #include "gif_lib.h"
I need animated webp not gif, let's just remove FrameSequence_gif.cpp from sources list in jni/Android.mk
BUILD SUCCESSFUL, ok let's try Sample
.../ex/framesequence/samples/FrameSequenceSamples$ ant debug install
BUILD SUCCESSFUL, ok lets start app and check
E/AndroidRuntime(23066): java.lang.UnsatisfiedLinkError: Couldn't load framesequence from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.android.framesequence.samples-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.android.framesequence.samples-1, /vendor/lib, /system/lib]]]: findLibrary returned null
Missed .so file. Founded it at ../../libs/armeabi-v7a/libframesequence.so
.../ex/framesequence/samples/FrameSequenceSamples$ mkdir libs/armeabi-v7a
.../ex/framesequence/samples/FrameSequenceSamples$ cp ../../libs/armeabi-v7a/libframesequence.so libs/armeabi-v7a/libframesequence.so
.../ex/framesequence/samples/FrameSequenceSamples$ ant clean debug install
BUILD SUCCESSFUL checking app
E/AndroidRuntime(23296): java.lang.RuntimeException: Unable to resume activity {com.android.framesequence.samples/com.android.framesequence.samples.FrameSequenceTest}: java.lang.IllegalArgumentException
After debugging framesequence library I have founded that FrameSequence_webp.cpp not added to registry. So Registry::Find(Stream) return NULL.
Add "FRAMESEQUENCE_INCLUDE_WEBP = true" line at top of jni/Android.mk should help.
.../ex/framesequence$ ant clean debug
[exec] jni/FrameSequence_webp.cpp:21:35: fatal error: webp/format_constants.h: No such file or directory
[exec] #include "webp/format_constants.h"
[exec] ^
I see from jni/Android.mk that it looks includes in external/webp
.../ex/framesequence$ ant clean debug
[exec] jni/FrameSequence_webp.cpp:21:35: fatal error: webp/format_constants.h: No such file or directory
[exec] #include "webp/format_constants.h"
[exec] ^
Maybe it looks in jni/webp/ instead of jni/external/webp
.../ex/framesequence$ mv jni/external/webp jni/
.../ex/framesequence$ ant clean debug
[exec] [armeabi-v7a] Compile++ thumb: framesequence <= BitmapDecoderJNI.cpp
[exec] [armeabi-v7a] Compile++ thumb: framesequence <= FrameSequence.cpp
[exec] [armeabi-v7a] Compile++ thumb: framesequence <= FrameSequenceJNI.cpp
[exec] [armeabi-v7a] Compile++ thumb: framesequence <= JNIHelpers.cpp
[exec] [armeabi-v7a] Compile++ thumb: framesequence <= Registry.cpp
[exec] [armeabi-v7a] Compile++ thumb: framesequence <= Stream.cpp
[exec] jni/FrameSequence_webp.cpp: In member function 'void FrameSequence_webp::constructDependencyChain()':
[exec] jni/FrameSequence_webp.cpp:60:9: warning: variable 'ok' set but not used [-Wunused-but-set-variable]
[exec] int ok = WebPDemuxGetFrame(mDemux, 1, &curr);
[exec] ^
[exec] jni/FrameSequence_webp.cpp: In member function 'virtual long int FrameSequenceState_webp::drawFrame(int, Color8888*, int, int)':
[exec] jni/FrameSequence_webp.cpp:304:9: warning: variable 'ok' set but not used [-Wunused-but-set-variable]
[exec] int ok = WebPDemuxGetFrame(demux, start, &currIter); // Get frame number 'start - 1'.[armeabi-v7a] Compile++ thumb: framesequence <= FrameSequence_webp.cpp
[exec]
[exec] ^
[exec] [armeabi-v7a] StaticLibrary : libstdc++.a
[exec] [armeabi-v7a] SharedLibrary : libframesequence.so
[exec] jni/FrameSequence_webp.h:35: error: undefined reference to 'WebPDemuxGetI'
[exec] jni/FrameSequence_webp.h:39: error: undefined reference to 'WebPDemuxGetI'
[exec] jni/FrameSequence_webp.h:47: error: undefined reference to 'WebPDemuxGetI'
[exec] jni/FrameSequence_webp.cpp:128: error: undefined reference to 'WebPDemuxDelete'
[exec] jni/FrameSequence_webp.cpp:60: error: undefined reference to 'WebPDemuxGetFrame'
[exec] jni/FrameSequence_webp.cpp:65: error: undefined reference to 'WebPDemuxGetFrame'
[exec] jni/FrameSequence_webp.cpp:76: error: undefined reference to 'WebPDemuxReleaseIterator'
[exec] jni/FrameSequence_webp.cpp:77: error: undefined reference to 'WebPDemuxReleaseIterator'
[exec] jni/webp/demux.h:92: error: undefined reference to 'WebPDemuxInternal'
[exec] jni/FrameSequence_webp.cpp:118: error: undefined reference to 'WebPDemuxGetI'
[exec] jni/webp/decode.h:471: error: undefined reference to 'WebPInitDecoderConfigInternal'
[exec] jni/FrameSequence_webp.cpp:230: error: undefined reference to 'WebPDecode'
[exec] jni/FrameSequence_webp.cpp:304: error: undefined reference to 'WebPDemuxGetFrame'
[exec] jni/FrameSequence_webp.cpp:315: error: undefined reference to 'WebPDemuxGetFrame'
[exec] jni/FrameSequence_webp.cpp:358: error: undefined reference to 'WebPDemuxReleaseIterator'
[exec] jni/FrameSequence_webp.cpp:359: error: undefined reference to 'WebPDemuxReleaseIterator'
[exec] collect2: error: ld returned 1 exit status
[exec] make: *** [obj/local/armeabi-v7a/libframesequence.so] Error 1
Here is the end.
It seems it is missing library. There could be multiple solutions:
1. Build libwebp source code as is and add here .a library. For now I do not know how to achive it, there are Android.mk file, but:
.../libwebp$ ndk-build
Android NDK: Could not find application project directory !
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.
/home/dekalo/Android/ndk/android-ndk-r10e/build/core/
build-local.mk:143: *** Android NDK: Aborting . Stop.
2. Add source code of webp library to framesequence and compile it as Android.mk module.
3. On the other side if libwep is part of android platform, how to say to compiler/linker that that WebPDemuxGetI will be provided on platform.
4. Guide me please, if there are other more simple solutions.
I will be very gratefull for any help, and thank you for reading till the end.