2013年9月10日星期二

JNI compile-time error !

Now learning to make Android -driven development, the following appeared in compiling JNI error, please expert help answer, thank you !

make: into the directory '/ home/work/4.2.2_r1'
target SharedLib: libIrService (out/target/product/rk2928sdk/obj/SHARED_LIBRARIES/libIrService_intermediates/LINKED/libIrService.so)
/ home/work/4.2.2_r1/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/../lib/gcc/arm-linux-androideabi/4.6.x- google /.. /.. /.. /.. / arm-linux-androideabi / bin / ld: out/target/product/rk2928sdk/obj/SHARED_LIBRARIES/libIrService_intermediates/onload.o: in function JNI_OnLoad: frameworks / base / services / jni / onload.cpp: 68: error: undefined reference to 'android :: register_android_server_IrService (_JNIEnv *)'
collect2: ld returned 1 exit status
make: *** [out/target/product/rk2928sdk/obj/SHARED_LIBRARIES/libIrService_intermediates/LINKED/libIrService.so] Error 1
make: Leaving directory "/ home/work/4.2.2_r1"
root @ xiabei-desktop :/ home/work/4.2.2_r1/frameworks/base/services/jni #


------ Solution ---------------------------------- ----------
jni compiled , you do inside the system dry ah !
you downloaded from the official NDK, and then the sample files into your project folder , ndk-build

If not, you can go online to look , very simple ! If the test cases, downloads ndk tools , 20 to 30 seconds can be compiled hellojni

your steps a beginning is wrong
------ Solution --------------------------- -----------------
in ndk which has a arm-linux-androideabi-ld file ( specific location , look for yourself ) , you copy it to 4.4 . 3 directory renamed ld, on OK
------ For reference only --------------------------- ------------
landlord fix the problem ? I also encountered the same problem
------ For reference only ------------------------------- --------
tried it , the problem still exists
------ For reference only --------------------- ------------------
Oh , after an afternoon of torture, I solved the problem, made ​​a stupid mistake , android no definition , do not know the landlord is not is the problem

没有评论:

发表评论