Eclipse NDK JNI Configuration

Source: Internet
Author: User





The Jni folder will appear, i.e. below Hello_ndk.cpp and android.mk




At this point, the following problems will occur, although some people on the internet said that can be solved in the following way, yes, but there will be another problem, that is, if you want to build in the JNI directory C + + engineering and class, you will find that the corresponding



Find more ways to get online (feel Bad):


Another method is found later:

Select the project, right-->properties, click c/C + + general expansion, click Path and Symbols, on the right includes, click Add, the Ndk folder under the JNI header file and the corresponding C + + header file to add in. Be sure to fill in the complete path, such as the two paths I added are:

E:\AndroidNDK\android-ndk-r10c\toolchains\mipsel-linux-android-4.8\prebuilt\windows-x86_64\lib\gcc\ Mipsel-linux-android\4.8\include

E:\AndroidNDK\android-ndk-r10c\platforms\android-19\arch-arm\usr\include


can solve the problem.




This is followed by the creation of the appropriate Java interface to communicate with C/s:





and introduce so libraries in Java code



The GetString class generated header files, the online comparison is common with the cmd command generated, but this way is too troublesome


The following is done through the direct configuration in eclipse

1, first in the project to create a new



The code then references the following


</pre><pre code_snippet_id= "1675487" snippet_file_name= "blog_20160508_1_2733330" name= "code" class= "HTML" ><?xml version= "1.0" encoding= "UTF-8"?><!--========================================================= ============= May 8, 2016 afternoon 6:21:49 Hellondk DESCRI Ption Hejia =================== ===================================================--><project name= "hellondk" default= "BuildAllHeaders"           > <description> Description </description> <!--================================= Target:buildallheaders =================================--<target name= "Buildal Lheaders "> <antcall target=" buildgetstringheaders "> </antcall> <antcall target=" Buildgetinthea DERs "> </antcall> </target> <!  -------------------target:buildgetstringheaders-------- ----------<target name= "Buildgetstringheaders" > <javah destdir= "./jni" classpath= "./bin/cla Sses/"class=" com.example.hellondk.GetString "></javah> </target><!--========================== ======= Target:buildgetintheaders =================================-<target Name= "Buildgetintheaders" > <javah destdir= "./jni" classpath= "./bin/classes/" class= " Com.example.hellondk.GetInt "></javah> </target></project>
</pre><pre code_snippet_id= "1675487" snippet_file_name= "blog_20160508_1_2733330" name= "code" class= "HTML" >

Configuring the ant compiler header file




The following is a compilation of C + + issues. Online has been compiled directly with Ndk-builder, but that method is too complex, each construction project must be configured a large heap, in order to use, which is now directly with the CDT, according to the same method configuration, can automatically generate CDT builder



Eclipse NDK JNI Configuration

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.