Unresolved inclusion in the Java header in JNI

Source: Internet
Author: User

Eclipse's NDK development environment was built almost after opening the HELLO-JNI project in the JNI samples. Add native and run without problems, but open hello-jni.c see a piece of red:

Light This document involves some of the following issues, listed to facilitate search.

Unresolved inclusion: <string.h>

Unresolved inclusion: <jni.h>

Type ' jstring ' could not being resolved

Type ' jnienv ' could not being resolved

Type ' Jobject ' could not being resolved

There may also be newstringutf unresoved problems (workaround at the bottom)

The principle is not studied, and the solution may involve one or both of the following methods depending on the situation

Method One, resolve by rebuilding. Project and. Cproject

Source: Http://stackoverflow.com/questions/23122934/eclipse-adt-unresolved-inclusion-jni-h

1. Turn off eclipse

2. Open the. project file in the Hello-jni folder with tools such as notepad++ to remove the following three pieces of content

        <Buildcommand>            <name>Org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>            <triggers>Clean,full,incremental,</triggers>            <arguments>            </arguments>        </Buildcommand>

        <Buildcommand>            <name>Org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>            <triggers>Full,incremental,</triggers>            <arguments>            </arguments>        </Buildcommand>

        <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. Save

4. Delete the. cproject file under the same folder

5. Re-open Eclipse

6. Right-click Project-->android tools-->add Native support ... Click Finish

If the problem is not resolved,

Method Two, add the paths to the C and C + + libraries

Right-click Items---Properties--C + + general----and Path and Symbols-includes to the right of add ... button to add the include path in the NDK path, mine is:

D:\XunLeiDownload\android-ndk-r10e\platforms\android-16\arch-arm\usr\include

Refresh project, Problem solving:

For Newstringutf's unresoved problem, finding the next, imperfect solution is Window------Preferences---------cannot be re Solved this check can be removed.

Unresolved inclusion in the Java header in 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.