Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

Get excited for the Samsung Galaxy S5! Find everything you need and discuss it in our Galaxy S5 Forum!

test: Reply
 
LinkBack Thread Tools
Old October 11th, 2011, 02:54 AM   #1 (permalink)
New Member
Thread Author (OP)
 
Join Date: Nov 2010
Location: Athens, Greece
Posts: 12
 
Device(s): Xperia X10
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Confused 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(path to my activity);.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
 0x00000001 (NEEDED)                     Shared library: [liblog.so]
 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!

George Stam is offline  
Reply With Quote
sponsored links
Old October 12th, 2011, 10:43 AM   #2 (permalink)
Senior Member
 
jonbonazza's Avatar
 
Join Date: Jul 2010
Gender: Male
Posts: 1,936
 
Device(s): Nexus 4, Samsung Galaxy S II, HTC Evo 4G, Amazon Kindle Fire
Carrier: ATT

Thanks: 235
Thanked 478 Times in 292 Posts
Default

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?
jonbonazza is offline  
Reply With Quote
Reply
Tags
.mk, .so, bulid, librarys, local_ldlibs, native, ndk, unsatisfiedlinkerror


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 12:45 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.