Using the NDK to compile common solutions for Android projects with JNI

Source: Internet
Author: User

Sometimes, you download or copy the JNI project there is a inexplicable error, usually not find the head file, the possible solution is as follows: removing the C nature:

The only-I could find to reliably removed the C nature from the project is by hand editing Eclipse's .project file for T He project.

  1. Close the Eclipse project (e.g. by quitting Eclipse).

  2. Open the .project file in a text or XML editor. There'll is at least 2 <buildCommand> nodes that need to be removed. The Remove <buildCommand> org.eclipse.cdt.managedbuilder.core.genmakebuilder the node with name and all it children, and the node with name and its <buildCommand> org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder children. Finally, remove the lines:

    <nature>org.eclipse.cdt.core.cnature</nature><nature>org.eclipse.cdt.core.ccnature</nature> <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature><nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>

  3. Completely Remove the .cproject file.

Adding back the Android Native nature

Reopen the project in Eclipse. Then right-click on the project Explorer, and from the "Android Tools" contextual menu, choose "Add Native Support ... ".

Reference:Http://stackoverflow.com/questions/23122934/eclipse-adt-unresolved-inclusion-jni-hAndroid JNI Project Tip "Unresolved inclusion: <jni.h>" possible other solutions:
    1. Paths and symbols path is not correct, consider modifying the contents of android.mk file, such as adding blank lines (note that the Android file does not require a local_c_includes field, the system will be based on LOCAL_SRC_ Files automatically add the required header files, otherwise the header file will appear ambiguity), re-compile the project, the Android.mk file local_src_files will depend on the header file in the project Properties Paths and symbols are automatically added;
    2. String.h, jni.h and other C-header file "unresolved inclusion", consider: NDK Project--New--------Link to alternate Lo cation (Linked Folder), added: D:\ADT\android-ndk-r9d\platforms\android-18\arch-arm\usr\include;
    3. Consideration: Properties--->c/c++ general, turn off the code analysis function and resolve most errors;

Using the NDK to compile common solutions for Android projects with JNI

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.