Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6537763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:39:21+00:00 2026-05-25T10:39:21+00:00

I am using Eclipse to experiment Android NDK programming. My platform info is as

  • 0

I am using Eclipse to experiment Android NDK programming. My platform info is as follows:

  1. Windows 7.
  2. Eclipse platform. I can use this eclipse platform to build android apps without hassle; no problem with it.
  3. Cygwin with development package installed. The version of
    “make” is GNU Make 3.81.

I code a very simple native c function as well as Android.mk shown as follows:

———–../jni/get_string_native.c———

#include <jni.h>
#include <string.h>
#include <android/log.h>
#include <stdio.h>

jstring Java_geil_learn_ndk_NDKStringActivity_getString(JNIEnv * env, jobject this, jint value1, jint value2)
{
     char *szFormat = "The sum of the two numbers is: %i";
     char *szResult;

    // add the two values
     jlong sum = value1+value2;

    // malloc room for the resulting string
    szResult = malloc(sizeof(szFormat) + 20);

    // standard sprintf
    sprintf(szResult, szFormat, sum);

    // get an object string
    jstring result = (*env)->NewStringUTF(env, szResult);

    // cleanup
    free(szResult);

   return result;
}

————–../jni/Android.make———-

# LOCAL_PATH := $(call my-dir)  
#   
# include $(CLEAR_VARS)  
#   
# LOCAL_LDLIBS := -llog  
#   
# LOCAL_MODULE    := get_string_native  
# LOCAL_SRC_FILES := get_string_native.c  
#   
# include $(BUILD_SHARED_LIBRARY)

Now I tried to use ndk-build to produce the shared library, but nothing happen. Even no error message showed up. See below:

——- From Cygwin terminal ———

Administrator@XP-201011081632 /cygdrive/d/eclipse_projects/workspace/NDKString/jni
$ ndk-build

Administrator@XP-201011081632 /cygdrive/d/eclipse_projects/workspace/NDKString/jni
$

Surely, I have set up the environment variable PATH and build it in \jni.

I am really confused now; please help me!!


I have removed # in the Android.make file. Now it can generate the corresponding .so file in /lib. But when I call the native method in an activity, run-time error occurred. Logcat info is as follows. Would u please help me?

Trying to load lib /data/data/geil.learn.ndk.NDKStringAcivity/lib/libnative.so 0x405151f0
Added shared lib /data/data/geil.learn.ndk.NDKStringAcivity/lib/libnative.so 0x405151f0
No JNI_OnLoad found in /data/data/geil.learn.ndk.NDKStringAcivity/lib/libnative.so 0x405151f0, skipping init
60): Displayed geil.learn.ndk.NDKStringAcivity/.NDKStringActivity: +1s145ms
No implementation found for native Lgeil/learn/ndk/NDKStringAcivity/NDKStringActivity;.getString (II)Ljava/lang/String;
344): Shutting down VM threadid=1: thread exiting with uncaught exception (group=0x40015560)
344): FATAL EXCEPTION: main
344): java.lang.UnsatisfiedLinkError: getString
344):        at geil.learn.ndk.NDKStringAcivity.NDKStringActivity.getString(Native Method)
344):        at geil.learn.ndk.NDKStringAcivity.NDKStringActivity.onClick(NDKStringActivity.java:40)
344):        at android.view.View.performClick(View.java:2485)
344):        at android.view.View$PerformClick.run(View.java:9080)
344):        at android.os.Handler.handleCallback(Handler.java:587)
344):        at android.os.Handler.dispatchMessage(Handler.java:92)
344):        at android.os.Looper.loop(Looper.java:123)
344):        at android.app.ActivityThread.main(ActivityThread.java:3683)
344):        at java.lang.reflect.Method.invokeNative(Native Method)
344):        at java.lang.reflect.Method.invoke(Method.java:507)
344):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
344):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
344):        at dalvik.system.NativeStart.main(Native Method)
60):   Force finishing activity geil.learn.ndk.NDKStringAcivity/.NDKStringActivity
60): Activity pause timeout for HistoryRecord{407868c8) geil.learn.ndk.NDKStringAcivity/.NDKStringActivity} Sending signal. PID: 344 SIG: 9
60): Process geil.learn.ndk.NDKStringAcivity (pid 344) has died.
60): WIN DEATH: Window{4073a7c0 geil.learn.ndk.NDKStringAcivity/geil.learn.ndk.NDKStringAcivity.NDKStringActivity paused=false}
(60): Got RemoteException sending setActive(false) notification to pid 344 uid 10037
60): Activity destroy timeout for HistoryRecord{407868c8 geil.learn.ndk.NDKStringAcivity/.NDKStringActivity}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:39:22+00:00Added an answer on May 25, 2026 at 10:39 am

    As Salw has already pointed out you will need to change the extension.

    A # in the .mk file is a comment, you basically your make file is an empty makefile. Remove the # from the .mk file.

    Also you will need to give the include directory which contains the header files..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As an experiment we want to build our products using the Eclipse java compiler
I using Eclipse and the Android emulator. Can someone tell me what is wrong
When using Eclipse over X-Windows on a remote shell (X port forwarding), is there
Using Eclipse + PDT, I know that you can specify the return type of
Using Eclipse 3.5 and the plugin for mtj. Where can I find the Javadoc
I using Eclipse Helios and JDK6 , The Android SDK virtual device make a
I am using Eclipse 3.6 product export to build an Equinox-based OSGi application. I
im using eclipse for python but i dont know for php.. how can i
I'm using Eclipse 3.5.2 for Android development on Ubuntu 10.04. I installed: Sun's JDK
I've been using Eclipse with PyDev (on Windows, mind you) for my Python Tkinter

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.