简体   繁体   English

Android NDK不链接静态库

[英]Android NDK doesn't link static library

Some mystery is going on with my project :) 我的项目有些神秘:)

I have a shared library that uses libjpeg which is static library. 我有一个使用libjpeg的共享库,它是静态库。 It all worked fine but now when I need to add a few changes to the project it just stopped including libjpeg in my shared module. 一切正常,但是现在当我需要对项目进行一些更改时,它刚刚停止在共享模块中包含libjpeg。

So before when it worked, my shared module (.so file) was around 90Kb and now it 4Kb and application can't run saying that it can't find libjpeg.so 因此,在工作之前,我的共享模块(.so文件)大约为90Kb,现在为4Kb,应用程序无法运行,并说找不到libjpeg.so。

And folders structure is following: /platform/libjpeg - include files for libjpeg /platform/libraries - contain libjpeg.a and a few other libraries 文件夹结构如下:/ platform / libjpeg-包含libjpeg的文件/ platform / libraries-包含libjpeg.a和其他一些库


UPDATE: After playing around with the projects I figured out that the problem appeared after I wanted to add android:installLocation into manifest. 更新:玩完项目后,我发现问题是在我想将android:installLocation添加到清单后出现的。 Following Google's recommendations for backward compatibility (http://developer.android.com/guide/appendix/install-location.html) I changed project's API level to 8 (so it parses manifest without errors) and left minSdkVersion="7" (so it runs on previous version). 遵循Google关于向后兼容性的建议(http://developer.android.com/guide/appendix/install-location.html),我将项目的API级别更改为8(这样它就可以解析清单而没有错误),并将minSdkVersion =“ 7”(因此它可以在旧版本上运行)。 However, this particular change in the project affects the NDK build. 但是,项目中的此特定更改会影响NDK的构建。 Probably, libjpeg is included in android-8 and it doesn't want to build it in as a static library? 可能是,libjpeg包含在android-8中,它不想将其构建为静态库吗?

Anyway, the question is: Is it possible in eclipse to ignore error about installLocation in manifest using API level 7 or is it possible to force ndk-build to use API level 7 while keeping level 8 in the project settings? 无论如何,问题是:Eclipse是否可以使用API​​级别7忽略清单中关于installLocation的错误,还是可以强制ndk-build使用API​​级别7,同时在项目设置中保持级别8?

In NDK you can find document docs/ANDROID-MK.html. 在NDK中,您可以找到文档docs / ANDROID-MK.html。 In this document you will find option TARGET_PLATFORM. 在本文档中,您将找到选项TARGET_PLATFORM。 This should help. 这应该有所帮助。

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

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