当前位置:编程学习 > JAVA >>

android NDK打包编译

安装NDK 和cygwein就不多说了,安装完之后,新建一个项目testlibc项目,把NDK samples中test-libstdc++例子打包为共享包,然后把jni,libs,obj放入项目目录,在NDK samples中test-libstdc++例子中 test-libstdc.cpp中#include <cerrno>
#include <cstddef>

int main(void)
{
    return 0;

在我的com.test.MainActivity中写了
 public static native int main();
在Oncreate()中:TextView tv = new TextView(this);
tv.setText("返回:\n" + main());
setContentView(tv);
运行项目报Exception in thread "main" java.lang.UnsatisfiedLinkError:main 问题,网上查说可能是没导入包或者我是库中没有包含main()方法,我已经正确导入了。so库,可为何不能访问这个方法?是特殊还怎么?有高手能解答?谢谢!
补充:Java ,  Eclipse
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,