简体   繁体   English

无法识别NDK预建的共享库文件格式

[英]NDK prebuilt shared library file format not recognized

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. 我一直试图在github上关注这个示例以获得基本的spotify实现工作,我已经按照设置步骤,安装了所有必需的库等,但在本机构建阶段继续收到以下错误。

**** 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. 我下载了特定于android的库,然后尝试了各种Linux ARM库组合,看看会发生什么,结果总是一样的。 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. 从目录中删除libspotify.so ,构建因预期失败,因为无法找到该文件,因此我知道该脚本正在尝试处理该文件。

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? 据我所知,我已经按照设置进行了说明,我目前的猜测是问题与运行64位版本的eclipse / java等有关。有谁可以解决这个问题?

You need to find out what is the compilable target of this file. 您需要找出此文件的可编译目标。 If you use linux, run the following command: 如果使用linux,请运行以下命令:

$ file libspotify.so

You will see if it can compile with armeabi or x86 . 您将看到它是否可以使用armeabix86进行编译。 Then, in application.mk , you need to set up the APP_ABI to armeabi or APP_ABI:X86 . 然后,在application.mk ,您需要将APP_ABI设置为armeabiAPP_ABI:X86

It turns out this issue was caused by a corrupt archive with the .so file. 事实证明,此问题是由.so文件的损坏存档引起的。

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 . 我找到了一个libspotify.so文件的版本,该文件已在此处正确提取。

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) . 我相信你可能不小心提取了libspotify.so (21 bytes) ,它只是共享库libspotify.so.12.1.51 (1,961,644 bytes)的Unix符号链接。

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. 后者需要重命名为查找名称(libspotify.so),然后NDK才能正常运行。

Hope this helps another tired soul, at least. 希望这至少可以帮助另一个疲惫的灵魂。 :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM