开发者

how to use libssl.so in an android project?

开发者 https://www.devze.com 2023-03-08 04:12 出处:网络
I did 开发者_JAVA技巧build the libssl.so from openssl project with Android NDK under the mac os x shell and now I would like someone to tell me how i can use it in Eclispe and in my android project ?

I did 开发者_JAVA技巧build the libssl.so from openssl project with Android NDK under the mac os x shell and now I would like someone to tell me how i can use it in Eclispe and in my android project ?

Is it ok if I drag and drop the file in the project root directory ??

How can I access the library function from the code ??

I saw this example :

// load the library - name matches jni/Android.mk

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

  // declare the native code function - must match ndkfoo.c

  private native String invokeNativeFunction();

...

file ndkfoo.c :
jstring Java_com_mindtherobot_samples_ndkfoo_NdkFooActivity_invokeNativeFunction(JNIEnv* env, jobject javaThis) {
  return (*env)->NewStringUTF(env, "Hello from native code!");
}

But the libssl.so has it own functions list and they not named with my java class name i guess...

Any idea ?


to link .so file to yr project, u need to right click project->properties->Java Build Path->Library->Android 2.* -> Native Library location ->Edit -> browse to .so file folder path

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号