简体   繁体   English

gnustl_shared的Android NDK构建问题

[英]Android NDK build issue with gnustl_shared

I have a problem with my Android NDK Project. 我的Android NDK项目有问题。

My project consists of 2 projects: a library and an application. 我的项目由2个项目组成:一个库和一个应用程序。

I want to use gnustl_shared and have gnustl_shared.so in a resulting .apk file. 我想使用gnustl_shared并在生成的.apk文件中使用gnustl_shared.so。

So I have APP_STL := gnustl_shared in both of my Application.mk files. 所以我的两个Application.mk文件都具有APP_STL:= gnustl_shared。

The problem is that if I do so it gives me the following error: 问题是,如果这样做,则会出现以下错误:

Error generating final archive: Found duplicate file for APK: lib/armeabi/libgnustl_shared.so
Origin 1: /Volumes/STUFF/repos/trunk/android/MainActivity/libs/armeabi/libgnustl_shared.so
Origin 2: /Volumes/STUFF/repos/trunk/android/MyLib/libs/armeabi/libgnustl_shared.so

If I use APP_STL := gnustl_shared for one project only it builds, but links against static library (as it should, actually). 如果我仅对一个项目使用APP_STL:= gnustl_shared,则它会生成,但会链接到静态库(实际上应该链接到静态库)。

Does anyone know how to link agains gnustl_shared in both library and application and avoid this error? 有谁知道如何在库和应用程序中再次链接gnustl_shared并避免此错误? Any help or even clue is much appreciated. 任何帮助或线索,我们将不胜感激。

Problem solved. 问题解决了。

  1. Select library project 选择图书馆项目
  2. Navigate to: Project->Properties->Java Build Path 导航到:项目->属性-> Java构建路径
  3. Select "Order and Export" tab 选择“订单和导出”标签
  4. Uncheck "Android Private Libraries" and "Android Dependencies" 取消选中“ Android Private Libraries”和“ Android Dependencies”

They will anyway be added to the final .apk with the application config. 无论如何,它们将通过应用程序配置添加到最终的.apk中。

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

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