help with ndk build

Last Updated:

  1. George Stam

    George Stam Member

    hello guys,

    I need to use a native library in my app but with all the ways I've tryed to build it, I get the following warning:
    Code (Text):
    1. 10-11 10:33:51.095: WARN/dalvikvm(337): No implementation found for native L[I](path to my activity)[/I];.Init (Ljava/lang/String;IIIII)I
    and then the error
    Code (Text):
    1. 10-11 10:33:51.115: ERROR/AndroidRuntime(337): java.lang.UnsatisfiedLinkError: Init
    I have downloaded the library and I'm not familiar with c++ to modify or debug it if that is the case but I believe that my error comes from the file which was like this when downloaded:
    Code (Text):
    1. LOCAL_PATH := $(call my-dir)
    3. include $(CLEAR_VARS)
    5. LOCAL_MODULE    := gifflen
    6. LOCAL_SRC_FILES := gifflen.cpp
    7. LOCAL_LDLIBS := -L/cygdrive/c/android-ndk-1.5_r1-windows/android-ndk-1.5_r1/build/platforms/android-1.5/arch-arm/usr/lib -llog
    8. include $(BUILD_SHARED_LIBRARY)
    but because i use linux and ndk-r6b, i've modyfied it like:
    Code (Text):
    1. LOCAL_LDLIBS += -L/home/me/android-ndk-r6b/platforms/android-3/arch-arm/usr/include/android/ -llog
    This may be useful too:
    Code (Text):
    1. $ readelf -d
    3. Dynamic section at offset 0x53ac contains 26 entries:
    4.   Tag        Type                         Name/Value
    5.  [B]0x00000001 (NEEDED)                     Shared library: [][/B]
    6.  0x00000001 (NEEDED)                     Shared library: []
    7.  0x00000001 (NEEDED)                     Shared library: []
    8.  0x00000001 (NEEDED)                     Shared library: []
    9.  0x00000001 (NEEDED)                     Shared library: []
    10.  0x0000000e (SONAME)                     Library soname: []
    11.  0x00000010 (SYMBOLIC)                   0x0
    12.  0x00000019 (INIT_ARRAY)                 0x6394
    13.  0x0000001b (INIT_ARRAYSZ)               12 (bytes)
    14.  0x0000001a (FINI_ARRAY)                 0x63a0
    15.  0x0000001c (FINI_ARRAYSZ)               12 (bytes)
    16.  0x00000004 (HASH)                       0xd4
    17.  0x00000005 (STRTAB)                     0xf54
    18.  0x00000006 (SYMTAB)                     0x564
    19.  0x0000000a (STRSZ)                      2464 (bytes)
    20.  0x0000000b (SYMENT)                     16 (bytes)
    21.  0x00000003 (PLTGOT)                     0x649c
    22.  0x00000002 (PLTRELSZ)                   176 (bytes)
    23.  0x00000014 (PLTREL)                     REL
    24.  0x00000017 (JMPREL)                     0x19e4
    25.  0x00000011 (REL)                        0x18f4
    26.  0x00000012 (RELSZ)                      240 (bytes)
    27.  0x00000013 (RELENT)                     8 (bytes)
    28.  0x00000016 (TEXTREL)                    0x0
    29.  0x6ffffffa (RELCOUNT)                   28
    30.  0x00000000 (NULL)                       0x0
    Any help would be greatly appreciated and I thank you for your time in advance,

  2. jonbonazza

    jonbonazza Well-Known Member

    A makefile uses a lot of information about your project, and without knowing this info, it's hard to make a proper make file.
    Here is some explanation of what each part of the makefile is for.
    Code (Text):
    2. #First of all, this is a very limited make file,
    3. #and depending on your project, there might be a lot more needed
    5. LOCAL_PATH := $(call my-dir)
    7. include $(CLEAR_VARS)
    9. #This is what you want to name the library.
    10. #if you downloaded this make file, then you want to change this
    11. LOCAL_MODULE    := gifflen
    13. #This is a list of source files that will be compiled, seperated by a '\'.
    14. #Again, if you downloaded this make file, then you want to change this
    15. #and add your own files.
    16. LOCAL_SRC_FILES := gifflen.cpp
    18. #You shouldn't need to explicitly link to this, so I commented this line out
    19. #LOCAL_LDLIBS := -L/cygdrive/c/android-ndk-1.5_r1-windows/android-ndk-1.5_r1/build/platforms/android-1.5/arch-arm/usr/lib -llog
    21. #this means your are building a shared libary, rather than a static libarary.
    22. include $(BUILD_SHARED_LIBRARY)
    That's a basic, and very limited, make file.

    My next question is this: Is your C++ code using any other libraries?

Share This Page