【发布时间】:2014-11-27 22:19:57
【问题描述】:
我尝试使用 c++ 代码 (NDK) 运行我的 android 应用程序。制作了文件 libF.so。没有错误的应用程序运行但 得到“不幸的是已经停止”。我用过 try and catch 但不是消息。我什至清除了 C++ 函数的主体。 我不知道该怎么办而且我不知道问题出在哪里。
我的英文不好,请见谅
我的java代码是:
public class main extends Activity {
/** Called when the activity is first created. */
static{
System.loadLibrary("F");
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
try{
mainc();
}catch (Exception e) {
// TODO: handle exception
Log.e("lee", e.getMessage());
}
}
private static native void mainc();
}
c++代码(F.cpp):
#include <jni.h>
#define JNIIMPORT
#define JNIEXPORT __attribute__ ((visibility ("default")))
#define JNICALL
using namespace std;
JNIEXPORT void JNICALL Java_com_opencv_filter_main_mainc(JNIEnv * jenv, jclass){}
【问题讨论】:
标签: android opencv android-ndk