Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error 1 libavcodec.so File format not recognized Android GL Live Wallpaper

I am trying to make a Live Wallpaper for android that plays an .mp4 video located on the device in android-asset (with the example I am using, it actually copies the file to the sdcard at runtime/doesn't matter)

I found this example And using this post I was able to get my eclipse set up with NDK and building the project. When building in eclipse using the NDK plugin I get this error in my problems window:

    Description Resource    Path    Location    Type
make: *** [libs/armeabi/libavcodec.so] Error 1  GLWallpaperVideoDemo-master         C/C++ Problem
make: *** Deleting file `libs/armeabi/libavcodec.so'    GLWallpaperVideoDemo-master         C/C++ Problem

I get the same error if I try to run ndk-build from command prompt.

I downloaded the project from the link above and then imported into eclipse. I added the lib GLWallpaperService to the build path, and made sure my NDK was setup. Knowing that the lib folder changed to libs I also tried moving the GLWallpaperService to the libs folder, which didn't help.

The project builds without NDK just fine in eclipse but obviously errors when trying to run the wallpaper because the native libraries were not built.

How can I resolve this error?

like image 571
laidbackjake Avatar asked Apr 19 '13 21:04

laidbackjake


2 Answers

The package you get by git clone https://github.com/frankandrobot/GLWallpaperVideoDemo.git is Linux oriented. The file jni\ffmpeg-android\build\ffmpeg\armeabi\lib\libavcodec.so and many others are simply symbolic links to actual files.

To make this all work easily on Windows, I suggest to go to the jni\ffmpeg-android\build\ffmpeg\armeabi\lib folder, and run

del *.so
copy libavcodec.so.52.99.1 libavcodec.so
copy libavcore.so.0.16.0 libavcore.so
copy libavdevice.so.52.2.2 libavdevice.so
copy libavfilter.so.1.69.0 libavfilter.so
copy libavformat.so.52.88.0 libavformat.so
copy libavutil.so.50.34.0 libavutil.so
copy libswscale.so.0.12.0 libswscale.so
like image 171
Alex Cohn Avatar answered Nov 06 '22 21:11

Alex Cohn


The issue might be because of a corrupted so file. Try to build the ffmpeg library again or find another version. Because I have a different error in eclipse when I try to compile the project:

C:/Android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/arm-linux-androideabi-strip:./libs/armeabi/libavcodec.so: File format not recognized

And when I search for this error it seems like the error is because of a corrupted file: NDK prebuilt shared library file format not recognized

Or the library is not in a format that Android can use: Error in linking C++ static library with android ndk(Error: file format not recognized)

like image 38
C.d. Avatar answered Nov 06 '22 20:11

C.d.