简体   繁体   中英

Android-NDK Project Eclipse build error

I have an Android project with native code. When I make a checkout from my repo and build the clean version it builds ok and starts on the device, but after I run project->clean eclipse command I got an error:

...
Install        : libgnustl_shared.so => libs/armeabi/libgnustl_shared.so

D:/android-ndk-r8b/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/arm-linux-androideabi-strip: unable to rename './libs/armeabi/libgnustl_shared.so'; reason: File exists
make: *** [libs/armeabi/libgnustl_shared.so] Error 1
make: *** Deleting file `libs/armeabi/libgnustl_shared.so'

**** Build Finished ****

This error can be reproduced in the Cygwin console with the same output (Yes, I'm working under MS Windows Vista).

I've got the same error when I was initializing the project. And it was solved by putting the libgnustl_shared.so file into obj/local/armeabi/libgnustl_shared.so and setting the 777 rights to all project files through the cygwin console running under administrator. But now this doesn't help.

You can find my project on the github https://github.com/aboritskiy/pacman
I haven't setup any project license yet, and I hope I'm not violating any other project licenses with this educational project.

The JNI-enabled functionality is in the jni-powered branch.

EDIT: It seems like I'm including the libgnustl_shared.so in wrong way.

您的存储库中有https://github.com/aboritskiy/pacman/blob/jni-powered/libs/armeabi/libgnustl_shared.so ,但 NDK 认为它应该在构建期间创建。

I observed this issue when I have Tortoise Git installed and TGitCache.exe is running in the background, and also the code which I am building is repository code.

Try killing TGitCache.exe in task manager and re-build.

Summarizing:

I wanted to add the libgnustl_shared.so to the project. I was using the Eclipse with Android Developer Tools plugin and Android Native Developer Tools plugin. But I had complation error, this error could be reproduced through eclipse and through the Cygwin console.

The problem was in misconfiguration of Android.mk : to include libgnustl_shared.so I have to add

  1. LOCAL_C_INCLUDES := sources/cxx-stl/gnu-libstdc++/include/ to Android.mk ,

  2. APP_STL := gnustl_shared to the Application.mk file.

But initially I had only the second option.

Great thanks to Alex Cohn for useful advices during this debug.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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