0

First, I am running a ubuntu 12.04 x86 virtual machine hosted on win8. I am compiling a c/c++ library to my android app.

After I use ndk-build in the directory, It seems the library and module were built successfully. And I can also see the .so file under libs/armeabi/ . However, when I import my project to eclipse, it always gives error that says can't find the lib, named event in this case. And I did unzip the apk file and find that the lib/armeabi/ .so is not packed in the apk file.

Below are detailed info, hope anyone can help me.

NDK build:

simon@ubuntu:~/projects/apps/latest/tgs-android/jni$ ndk-build 
 /home/simon/Android/android-ndk-r8c/build/core/add-application.mk:128: Android NDK:          WARNING: APP_PLATFORM android-14 is larger than android:minSdkVersion 11                a       in /home/simon/projects/apps/latest/tgs-android

ndroidManifest.xml

  Compile++ thumb  : swift <= NativeLib.cpp
    Compile++ thumb  : swift <= sha1.cpp
    Compile++ thumb  : swift <= compat.cpp
    Compile++ thumb  : swift <= sendrecv.cpp
    Compile++ thumb  : swift <= send_control.cpp
    Compile++ thumb  : swift <= hashtree.cpp
    Compile++ thumb  : swift <= bin.cpp 
    Prebuilt       : libevent.a <= jni/libevent2/lib/
    Prebuilt       : libstlport_static.a <= <NDK>/sources/cxx-stl/stlport/libs/armeabi/
    SharedLibrary  : libevent.so
    Install        : libevent.so => libs/armeabi/libevent.so

Can find it

simon@ubuntu:~/projects/apps/latest/tgs-android/jni$ ls ../libs/armeabi/ 
libevent.so

Another question I have is, when I tried using aapt a to add the .so lib to the .apk file, it seems succeed, however when I use adb install to install it on my device. It prompts out the:

 simon@ubuntu:~/projects/apps/latest/tgs-android/bin$ adb install IntroActivity.apk 
    2871 KB/s (1089288 bytes in 0.370s)
pkg: /data/local/tmp/IntroActivity.apk
    Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
    simon@ubuntu:~/projects/apps/latest/tgs-android/bin$ 

But I think the apk file has already been signed by eclipse in debug mode.

simon@ubuntu:~/projects/apps/latest/tgs-android/bin$ jarsigner -verify     IntroActivity.apk 
    jar verified.

Warning: This jar contains unsigned entries which have not been integrity-checked.

Re-run with the -verbose and -certs options for more details.

Any help is appreciated ! THANKS IN ADVANCE!

Miral Dhokiya
  • 1,716
  • 13
  • 25

1 Answers1

2

You can fix this by performing the following steps in Eclipse:

1.

  • Window -> Preferences -> C/C++ -> Build -> Settings
  • Select CDT GNU C/C++ Error Parser
  • In the Error Parser options at the bottom, add a new entry with the following contents:

    Severity: Warning
    Pattern: (.*?):(\d+): Android NDK: WARNING:(.*)
    File: $1
    Line: $2
    Description: $3
    

2. After that move this new item up just above its's upper one : (.*?):(\d+):(\d+:)? (.*)

This is discussed here : https://code.google.com/p/android/issues/detail?id=39752

nhahtdh
  • 52,949
  • 15
  • 113
  • 149