kalikali
unread,Nov 14, 2009, 8:36:16 PM11/14/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to android-ndk
Hi all,
This problem has stock me for a log time, hope some one can give me a
hint
I try to use a thirdparty library, and the third party just provide
the source codes with C++, I already build out the static library
(*.a) and then i put then in NDK process to build out shared library.
I put the following static library in the \android-ndk-1.6_r1\out\apps
\adobe2
libtetraphilia.a
libstdc++.a
libssl.a
libpxfstatic.a
libpng.a
libjpeg.a
libcryptutils.a
libcrypto.a
libc.a
libdl.a
libzlib.a
and write the Android.mk as
===================================================
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := adobelibtest
LOCAL_SRC_FILES := adobelibtest.cpp
LOCAL_STATIC_LIBRARIES := libpxfstatic libcryptutils libtetraphilia
libjpeg libpng libzlib libssl libcrypto libstdc++ libc libdl
include $(BUILD_SHARED_LIBRARY)
and finally the so is build out (libadobelibtest.so)
====================================================
following is my java codes
====================================================
package com.example.adobe;
import android.app.Activity;
import android.util.Log;
import android.widget.TextView;
import android.os.Bundle;
public class adobelibtest extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
Log.e("Cary", "before");
System.loadLibrary("adobelibtest");
Log.e("Cary", "after");
int z = test();
tv.setText( "The test result is " + z );
setContentView(tv);
}
public native int test();
}
===================================================
But the error happen on after Log.e("Cary", "before");
Unable to dlopen(/data/data/com.example.adobe/lib/libadobelibtest.so):
Cannot load library: reloc_library[1288]: 541 unknown reloc type 19@
0x811bd884 (35910)
I know the NDK support mini version of C++, and the third party source
codes C++ seem like use more than that ( ex : vector, map,
limits.....) , so i need to put the extra static libs list above in
folder \android-ndk-1.6_r1\out\apps\adobe2 to build out shared
library, I am not sure if it's a right solution, but that what i can
do. Or has anybody can tell me how to use a third party C++ solution
in android?
Thanks lot.
Michael