undefined reference to 'register_android_mytest_hellojni(_JNIEnv*)'问题

mr_president 2012-07-04 09:57:04

我参考网上:一个打通jni,java framework,application三层的练习
http://blog.chinaunix.net/uid-7922708-id-3043552.html
完全按照步骤做的,现在我在frameworks/base/core/jni目录下面敲mm编译出现如下错误:

target thumb C++: libandroid_runtime <= frameworks/base/core/jni/android_mytest_hellojni.cpp
target thumb C++: libandroid_runtime <= frameworks/base/core/jni/AndroidRuntime.cpp

target SharedLib: libandroid_runtime (out/target/product/msm8660_surf/obj/SHARED_LIBRARIES/libandroid_runtime_intermediates/LINKED/libandroid_runtime.so)
prebuilt/linux-x86/toolchain/arm-linux-androideabi-4.4.x/bin/../lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin/ld: out/target/product/msm8660_surf/obj/SHARED_LIBRARIES/libandroid_runtime_intermediates/AndroidRuntime.o: in function android::gRegJNI:AndroidRuntime.cpp(.data.rel.ro._ZN7androidL7gRegJNIE+0x0): error: undefined reference to 'register_android_mytest_hellojni(_JNIEnv*)'
collect2: ld returned 1 exit status

上面的问题有人问过,不过没有人回答,我也遇到了同样的问题,还请高人指点!
...全文
269 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
乾坤幻影 2013-12-16
  • 打赏
  • 举报
回复
文件android_mytest_hellojni.cpp中需要使用namespace android {} 在AndroidRuntime.cpp的namespace空间中也要声明那个函数,下面才可以使用。
xiaoxiaouser 2013-09-10
  • 打赏
  • 举报
回复
我刚刚学习android,也出现了这个问题,经过一下午的折磨终于解决了,不知楼主解决了没有,也不知道楼主和我的情况一不一样,我是犯了个低级错误,android 没定义,定义上就好了
bc_1 2013-07-26
  • 打赏
  • 举报
回复
我也遇到了,求高手解答!
KinHimTang 2013-04-12
  • 打赏
  • 举报
回复
LZ,你搞掂这个问题没

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧