Android NDK generated so file flow-ecplice

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.