1: Generate JNI Directory
First of all, on the internet, most blogs write this: Open the console, go to the project directory, run
Javah-classpath bin/classes-d JNI com.example.hellojni.MainAcitivity
I just want to ask, did you run the code yourself? What is your responsibility for writing this?
You will encounter this error when you write this.
It can actually be written like this:
1:javah-classpath src-d JNI Com.itg.jni.ImageBlur
or the path written to the Android.jar is executed directly
2:javah-classpath C:\project\Android\adt-bundle-windows-x86_64-20131030\sdk\platforms\android-22\android.jar; bin/classes-d JNI Com.itg.jni.ImageBlur
Then you'll get the Jni folder and the. h file in the project
Then write the C file.
3: Right-click Jni file to add android.mk file
Write configuration
Local_path: = $ (call My-dir) include $ (clear_vars) local_module : = jni_imageblurlocal_src_files: = Com_itg_jni_ Imageblur.cpplocal_ldlibs : =-ljnigraphics-lloginclude $ (build_shared_library)
Local_ldlibs : =-ljnigraphics-llog This sentence if useless to bitmap do not add.
My requirement is that the operation of the picture without this statement
Occurs when compiling a JNI CPP file:
jni/ndktest.cpp:21:error:undefined reference to ' Androidbitmap_getinfo 'jni/ndktest.cpp:22:error:undefined reference to ' __android_log_print 'jni/ndktest.cpp:26:error:undefined reference to ' __android_log_print 'jni/ndktest.cpp:29:error:undefined reference to ' Androidbitmap_lockpixels 'jni/ndktest.cpp:30:error:undefined reference to ' __android_log_print 'jni/ndktest.cpp:39:error:undefined reference to ' Androidbitmap_unlockpixels 'Collect2.exe:error:ld returned 1 exit statusMake.exe: * * * [obj/local/armeabi/libndktest.so] Error 1
2 Downloads NDK (Native development Kit)
2: Select the project to generate so files select Property-->builders-->new
Set location, add Ndk-build.cmd
Set up the JNI directory in working directory selection project
Set Build Options
Check
Set specify Resources and select the Jni folder directly. Complete, save, Ecplice will automatically generate the so file under the Armeabi folder
Android NDK generates so file flow-ecplice