[Android ndk jni] android-ndk-r9d + adt-bundle-windows environment construction-Hello-jni case study, androidndkr9d

Source: Internet
Author: User

[Android ndk jni] android-ndk-r9d + adt-bundle-windows environment construction-Hello-jni case study, androidndkr9d

Refer to the blog: http://blog.csdn.net/leilu2008/article/details/12495273


My android ndk version is: android-ndk-r9d-windows-x86_64.zip.

Reminder: do not save the package to a directory containing spaces after decompression. Otherwise, the compiler reports an error when compiling c and c ++ in jni.

NDK path cannot contain any spaces!

The version of the Eclipse environment used is: adt-bundle-windows-x86_64-20140321.zip.


Build:

1. decompress the tool separately.

Adt-bundle


Ndk




2. Add the sdk and ndk

Open Window -- "Preferreces

Select the sdk root directory



Select the root directory of the ndk



3. Add the test project hello-jni

Import the hello-jni project under the samples directory under ndk




After the project is imported, add the compiler, select the project, and right-click properties (NDK_builder I prepared in advance, here we want to create a new one)






Select program





Set as shown in the following figure.






Select a project



Bring the compiler up to the first place




In this way, the environment has been set up ~~~~~~~

Run as to start compiling. The libs file is automatically generated, and the so file in libs is automatically added to the java program. The earlier version also requires the build path operation. Very troublesome.



Running effect:







The Android NDK sample program Hello-jni fails to run.

Does native function define and implement matching? What code have you changed?

Android NDK compilation error. when compiling the JNI part of the project, an error is reported. The SO file cannot be generated successfully,

-The lcrypto library libcrypto. so is missing.
What system did you use? Why is there a d disk under linux?

There are also errors in the program.
Jni/OpensslWapper. cpp: 102: error: undefined reference to 'bn _ bn2hex'

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.