NDK prebuilt shared library file format not recognized
Asked Answered
E

3

4

I've been trying to follow this sample on github to get a basic spotify implementation working, I've followed the setup steps, installed all the required libraries etc but keep getting the following error during the native build stage.

**** Build of configuration Default for project LoginActivity ****

c:\Android-ndk\android-ndk-r8e\ndk-build.cmd NDK_NO_WARNINGS=1 all 
Install        : libspotify.so => libs/armeabi/libspotify.so
c:/Android-ndk/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/arm-linux-androideabi-strip:./libs/armeabi/libspotify.so: File format not recognized
make: *** [libs/armeabi/libspotify.so] Error 1
make: *** Deleting file `libs/armeabi/libspotify.so'

**** Build Finished ****

I downloaded the android specific library, then tried various combinations of Linux ARM libraries just to see what would happen and the result is always the same. When removing libspotify.so from the directory the build fails as expected because the file can't be found so I know the script is trying to process the file.

As far as I can tell I've followed the setup to the letter, my current guess is that the problem is related to running a 64 bit version of eclipse/java etc. Can anyone shed any light on this issue?

Eyre answered 28/3, 2013 at 11:23 Comment(1)
remove LOCAL_SRC_FILES := libspotify.so line from Android.mk file and if you want to include libspotify then use LOCAL_SRC_FILES := libspotify.a for this u will need to compile libspotify library with Shared or static optionSalley
E
1

It turns out this issue was caused by a corrupt archive with the .so file.

When I re-downloaded it, it worked fine. Thanks for the assistance.

EDIT

I found a version of the libspotify.so file which had been extracted properly here.

Eyre answered 11/4, 2013 at 9:30 Comment(2)
I'm having the same file-format problem. I've tried it a few times extracting the libspotify on Windows using 7zip, cygwin and on linux. Did you do something special to get it working? I've tried it on windows and os x with different libspotify (45 & 51) versions and ndk versions (8re & 8rb). I always get the same error :(Eventually
I eventually found a project on github using it where the archive had been included, I guess someone unpacked it successfully and bundled it in to avoid all this trouble. I can dig out the link for you if you likeEyre
P
3

You need to find out what is the compilable target of this file. If you use linux, run the following command:

$ file libspotify.so

You will see if it can compile with armeabi or x86. Then, in application.mk, you need to set up the APP_ABI to armeabi or APP_ABI:X86.

Pursuance answered 18/12, 2013 at 1:42 Comment(0)
E
1

It turns out this issue was caused by a corrupt archive with the .so file.

When I re-downloaded it, it worked fine. Thanks for the assistance.

EDIT

I found a version of the libspotify.so file which had been extracted properly here.

Eyre answered 11/4, 2013 at 9:30 Comment(2)
I'm having the same file-format problem. I've tried it a few times extracting the libspotify on Windows using 7zip, cygwin and on linux. Did you do something special to get it working? I've tried it on windows and os x with different libspotify (45 & 51) versions and ndk versions (8re & 8rb). I always get the same error :(Eventually
I eventually found a project on github using it where the archive had been included, I guess someone unpacked it successfully and bundled it in to avoid all this trouble. I can dig out the link for you if you likeEyre
W
1

I believe you may have accidentally extracted libspotify.so (21 bytes), which is only a Unix symlink to the shared library libspotify.so.12.1.51 (1,961,644 bytes).

At least that's what I had just done which led me here. The latter needs to be renamed to the lookup name (libspotify.so) and then NDK makes fine.

Hope this helps another tired soul, at least. :)

Wakeful answered 14/3, 2014 at 9:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.