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

  • SEARCH
  • Home
  • 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 8591747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:35:37+00:00 2026-06-11T23:35:37+00:00

I have a java project and now I want to add some NDK functionality.

  • 0

I have a java project and now I want to add some NDK functionality.

here is my Android.mk:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := android
LOCAL_CFLAGS    := -Wno-psabi
LOCAL_SRC_FILES := android.c
LOCAL_LDLIBS    := -L$(SYSROOT)/usr/lib -llog

include $(BUILD_SHARED_LIBRARY)

here is my android.c

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

#define DEBUG_TAG "NDK_AndroidNDK1SampleActivity"  

void Java_ru_tonybo_app_NativeRenderer_print(JNIEnv* env, jobject thiz, jstring message) {
    jboolean isCopy;  
    const char * szMessage = (*env)->GetStringUTFChars(env, message, &isCopy);

    __android_log_print(ANDROID_LOG_DEBUG, DEBUG_TAG, "NDK:LC: [%s]", szMessage);

    (*env)->ReleaseStringUTFChars(env, message, szMessage);
}

here is my related java class

package ru.tonybo.app;

public class NativeRenderer {
    public NativeRenderer (String message) {
        print(message);
    }

    public native void print(String message);

    static {
        System.loadLibrary("android");
    }
}

NDK compilation through cygwin is ok

TonyBo@TonyBo-NoteBook /cygdrive/d/javaProjects/App_JNI/jni
$ /cygdrive/d/android-ndk-r8b/ndk-build -B
Cygwin         : Generating dependency file converter script
Compile thumb  : android <= android.c
SharedLibrary  : libandroid.so
Install        : libandroid.so => libs/armeabi/libandroid.so

libandroid.so is created and placed in /libs/armeabi/libandroid.so

but when I launch the application in eclipse on the device, I got the exception UnsatisfiedLinkError on native call print(message);

What I’m missing here or doing wrong?
May be I should somehow tell eclipse to look for shared libraries, if so how to do this?

  • 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-06-11T23:35:38+00:00Added an answer on June 11, 2026 at 11:35 pm

    Your choice of libandroid name is not a good idea. The library libandroid.so exists in the system folder /system/lib. It is loaded into your app, and therefore your Load() call simply returns. If you change the name of your native library, everything will be well.

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

Sidebar

Related Questions

I have a Java project and I want to include a text file with
I have a Java project in Netbeans and I want to use some classes
I have installed Maven 3.0.4 and now want to run already created java project
I have my java project compiled and working fine but now I want to
Now we have a project with java 1.4 and ejb 2.1 running on jboss
I have developed a project in Java using NetBeans 6.1. I need to add
I have Java project that I formerly debugged using Sysdeo Launcher. Now I'd like
I have a java project that uses JPA 2/Hibernate 3.5.6 for data access and
I have a Java project that needs a addon interface. I was thinking about
I have a Java project in Eclipse with ~10 packages and ~10 class files

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.