NDK Newbie, Eclipse Question

Put problems with the Android NDK in this forum.

NDK Newbie, Eclipse Question

Postby paulscode » Wed Dec 01, 2010 3:21 am

I have source code for several libraries I want Eclipse/NDK to compile and place into the libs/armeabi folder. I have everything under the jni folder, and each library has an Android.mk file. But when I build the project, the libNAME.so files are not generated. What am I missing?

For reference, here is my Android.mk file in the jni folder:
Code: Select all
# The namespace in Java file, with dots replaced with underscores
SDL_JAVA_PACKAGE_PATH := de_schwardtnet_alienblaster

# Path to shared libraries - Android 1.6 cannot load them properly, thus we have to specify absolute path here
# SDL_SHARED_LIBRARIES_PATH := /data/data/de.schwardtnet.alienblaster/lib

# Path to files with application data - they should be downloaded from Internet on first app run inside
# Java sources, or unpacked from resources (TODO)
# Typically /sdcard/alienblaster
# Or /data/data/de.schwardtnet.alienblaster/files if you're planning to unpack data in application private folder
# Your application will just set current directory there
SDL_CURDIR_PATH := /data/data/de.schwardtnet.alienblaster/files

# Android Dev Phone G1 has trackball instead of cursor keys, and
# sends trackball movement events as rapid KeyDown/KeyUp events,
# this will make Up/Down/Left/Right key up events with X frames delay,
# so if application expects you to press and hold button it will process the event correctly.
# TODO: create a libsdl config file for that option and for key mapping/on-screen keyboard
SDL_TRACKBALL_KEYUP_DELAY := 1

# If the application designed for higher screen resolution enable this to get the screen
# resized in HW-accelerated way, however it eats a tiny bit of CPU
SDL_VIDEO_RENDER_RESIZE := 1

include $(call all-subdir-makefiles)


And Android.mk for one of the libraries, which is in jni/sdl_image:
Code: Select all
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := sdl_image

LOCAL_CFLAGS := -I$(LOCAL_PATH) -I$(LOCAL_PATH)/../jpeg -I$(LOCAL_PATH)/../png -I$(LOCAL_PATH)/../sdl/include \
            -DLOAD_PNG -DLOAD_JPG -DLOAD_GIF -DLOAD_BMP

LOCAL_CPP_EXTENSION := .cpp

# Note this simple makefile var substitution, you can find even simpler examples in different Android projects
LOCAL_SRC_FILES := $(notdir $(wildcard $(LOCAL_PATH)/*.c))

LOCAL_STATIC_LIBRARIES := png jpeg

LOCAL_SHARED_LIBRARIES := sdl

LOCAL_LDLIBS := -lz

include $(BUILD_SHARED_LIBRARY)


I am happy to provide more information if needed. I'm still new to Android development, so sorry if I've left out something important.
paulscode
Experienced Developer
Experienced Developer
 
Posts: 79
Joined: Thu Nov 11, 2010 3:57 pm

Top

Re: NDK Newbie, Eclipse Question

Postby paulscode » Wed Dec 01, 2010 11:48 pm

Aha! I figured it out - I just needed to select Android Tools->Add Native Support. I knew it would be something simple.
paulscode
Experienced Developer
Experienced Developer
 
Posts: 79
Joined: Thu Nov 11, 2010 3:57 pm

Re: NDK Newbie, Eclipse Question

Postby guian » Thu Dec 09, 2010 3:22 pm

paulscode wrote: I just needed to select Android Tools->Add Native Support. I knew it would be something simple.


did that help to anything ?

I didn't know about this feature before reading your post and I used the ndk without it for months...
using the ndk-build script from ndk r4
guian
Developer
Developer
 
Posts: 35
Joined: Tue Nov 18, 2008 3:43 pm

Re: NDK Newbie, Eclipse Question

Postby aashishvijayvirgiya » Wed Jun 01, 2011 10:25 am

new to android.
working on android jni(ndk).done some sample projects based on prebuilt library, having same problems
my androi.mk is

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE :=hello-jni
LOCAL_SRC_FILE:=hello-jni.c
LOCAL_SHARED_LIBRARY := ndk
include $(BUILD_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := ndk
NDK_MODULE_PATH := $(LOCAL_PATH)
LOCAL_SRC_FILES := libndk.so
include $(PREBUILT_SHARED_LIBRARY)

hello-jni.c calls functions from libndk.so(ARM lib.)

this project run successfully several times but when i restarted the eclipse and again run the project from eclipse.
emulator load the project. but having the problem calling funtions from shared library. it stopped unexpectedly. when i debug in logcat view it show unsatisfied linker error.
please help me out this problem.
attached the project also

my email address is ashish_vijayvirgiya@yahoo.com
if you want some additional information then you tell me.

thanks.
aashishvijayvirgiya
Freshman
Freshman
 
Posts: 8
Joined: Tue May 31, 2011 8:30 am

Top

Return to NDK Problems

Who is online

Users browsing this forum: No registered users and 2 guests