• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps help with ndk build

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:
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:
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 Android.mk file which was like this when downloaded:
Code:
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := gifflen
LOCAL_SRC_FILES := gifflen.cpp
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
include $(BUILD_SHARED_LIBRARY)
but because i use linux and ndk-r6b, i've modyfied it like:
Code:
LOCAL_LDLIBS += -L/home/me/android-ndk-r6b/platforms/android-3/arch-arm/usr/include/android/ -llog

This may be useful too:
Code:
$ readelf -d libgifflen.so 

Dynamic section at offset 0x53ac contains 26 entries:
  Tag        Type                         Name/Value
 [B]0x00000001 (NEEDED)                     Shared library: [liblog.so][/B]
 0x00000001 (NEEDED)                     Shared library: [libstdc++.so]
 0x00000001 (NEEDED)                     Shared library: [libm.so]
 0x00000001 (NEEDED)                     Shared library: [libc.so]
 0x00000001 (NEEDED)                     Shared library: [libdl.so]
 0x0000000e (SONAME)                     Library soname: [libgifflen.so]
 0x00000010 (SYMBOLIC)                   0x0
 0x00000019 (INIT_ARRAY)                 0x6394
 0x0000001b (INIT_ARRAYSZ)               12 (bytes)
 0x0000001a (FINI_ARRAY)                 0x63a0
 0x0000001c (FINI_ARRAYSZ)               12 (bytes)
 0x00000004 (HASH)                       0xd4
 0x00000005 (STRTAB)                     0xf54
 0x00000006 (SYMTAB)                     0x564
 0x0000000a (STRSZ)                      2464 (bytes)
 0x0000000b (SYMENT)                     16 (bytes)
 0x00000003 (PLTGOT)                     0x649c
 0x00000002 (PLTRELSZ)                   176 (bytes)
 0x00000014 (PLTREL)                     REL
 0x00000017 (JMPREL)                     0x19e4
 0x00000011 (REL)                        0x18f4
 0x00000012 (RELSZ)                      240 (bytes)
 0x00000013 (RELENT)                     8 (bytes)
 0x00000016 (TEXTREL)                    0x0
 0x6ffffffa (RELCOUNT)                   28
 0x00000000 (NULL)                       0x0

Any help would be greatly appreciated and I thank you for your time in advance,
cheers!
 
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:
#First of all, this is a very limited make file, 
#and depending on your project, there might be a lot more needed

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

#This is what you want to name the library. 
#if you downloaded this make file, then you want to change this
LOCAL_MODULE    := gifflen

#This is a list of source files that will be compiled, seperated by a '\'.
#Again, if you downloaded this make file, then you want to change this
#and add your own files.
LOCAL_SRC_FILES := gifflen.cpp

#You shouldn't need to explicitly link to this, so I commented this line out
#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

#this means your are building a shared libary, rather than a static libarary. 
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?
 
Back
Top Bottom