Create a federated compilation environment for the NDK for Eclipse.

Source: Internet
Author: User

1 Establishment of the project

Run Eclipse and create a new Android project named Hello-jni (or something else you like, such as Fxxk-jni).

Project code from your ndk/samples/hello-jni copy one copy, remember to copy jni that directory, the final directory structure.

The Libs directory will be created automatically, and now it's okay to have wood.

If you run this project now, you will see the following error on the Android console:

Java.lang.UnsatisfiedLinkError:Library Hello-jni not found

Because you haven't made that libhello-jni.so out yet.

2. Configure project Properties

Open Hello-jni Project Properties, select Builder, select program, click OK

  

  

Configure as follows, name any one, location and working directory to be consistent with your Cygwin directory, arguments to your project directory.

My arguments is:--login-c "Cd/cygdrive/e/workspace/hello-jni && $ANDROID _ndk_root/ndk-build"

The picture above should be visible, then check the other configuration as follows

Note When you tick specify working set of relevant resources, specify the resource to select the JNI directory for your project.

When the above steps are correctly configured, the C-related code in the JNI directory should be automatically compiled and the corresponding. So library files are automatically created after the configuration is saved to the Libs directory of the project.

The compile-time console output resembles the following:

Run the project again and the results are correct.

After the C code changes, save will automatically trigger the compilation, saving time and effort.

Create a federated compilation environment for the NDK for Eclipse.

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.