Posts

Showing posts with the label NDK

java.lang.UnsatisfiedLinkError: Native method not found

Question: I'm trying to make a NDK application, but i get this error java.lang.UnsatisfiedLinkError: Native method not found: com.example.hellondk.jni.HelloNDK.hello:()I I don't understand because the name of the C++ funtion is the same as the java packagename and class HelloNDK.cpp #include <jni.h> JNIEXPORT jint JNICALL Java_com_example_hellondk_jni_HelloNDK_hello ( JNIEnv * env , jobject o ){ return ( jint ) 2 ; } HelloNDK.java package com . example . hellondk . jni ; public class HelloNDK { public native int hello (); static { System . loadLibrary ( "HelloNDK" ); } } Android.mk LOCAL_PATH := $ ( call my - dir ) include $ ( CLEAR_VARS ) LOCAL_MODULE := HelloNDK LOCAL_SRC_FILES := HelloNDK . cpp include $ ( BUILD_SHARED_LIBRARY )     Solution 1:   You're exporting it as a C++ function, but the JNI linker doesn't understand C++ name mangling, so it won't be able to find...

LOCAL_SHARED_LIBRARIES and LOCAL_LDLIBS

Question: hello i would like to ask the differences between LOCAL_SHARED_LIBRARIES and LOCAL_LDLIBS for example , i try to link skia in mydroid  i need to use LOCAL_SHARED_LIBRARIES = libskia but in NDK i need to use LOCAL_LDLIBS = -lskia so i am wondering what's the differences and why do i need to two different ways for my Android.mk thanks  Solution: Libraries that are linked via LOCAL_LDLIBS will not have any dependencies generated for them. So, typically, LOCAL_LDLIBS should be used when you don't want to or don't have the resources to build the specific library. So, if you are using a library provided by the NDK, you *technically* don't need to rebuild the provided libraries. So, in your case, in your "mydrdoid", if you use: LOCAL_LDLIBS := -lskia" ...then, libskia.so *need not* be rebuilt. whereas, if you use: LOCAL_SHARED_LIBRARIES := libskia ... then libskia.so *will* be rebuilt if there are any changes in it's dependencies.  ...

Android ndk-build iostream: No such file or directory

I think "APP_STL:=stlport_static" must be in Application.mk file. Create a "Application.mk" file and write "APP_STL:=stlport_static" in it.