Android uses OPENCV's compiled environment non-cygwin mode (WIN7+ECLIPSE+ADT+CDT+NDK)

Source: Internet
Author: User

This article is entirely based on official website: https://dl-ssl.google.com/android/eclipse/

Only a simple three-step, the official website written very concise and comprehensive, very admire

Prepare

1. Eclipse (Indigo)

2. ADT: This does not say, is nothing more than Eclipse add an Android installation source, if you choose the NDK plugin, it will automatically install the CDT yo;

3. NDK(android-ndk-r9d-windows-x86_64)

Address: Http://developer.android.com/tools/sdk/ndk/index.html#Installing Choose the right version for you;

Enough, here are a few simple configurations:


After the "configuration A" NDK and CDT installation is complete, a similar page can be seen in the project properties.


Once and for all, add the ndkroot path to your extracted NDK path in the system environment variable,



"Configuration B, adding header files for C/C + +"

At this time the compilation will also prompt STD what unresolved, add header file contains path bar, you can check the apply to all configuration;

Open Project Properties, c/C + + general Paths and Symbols and add the following Include Paths For C + +:

# for NDK R8 and prior:${ ndkroot}/platforms/android-9/arch-arm/usr/include${ndkroot}/sources/cxx-stl/gnu-libstdc++/include${ndkroot}/ Sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/include  ${ projdirpath}/. /.. /sdk/native/jni/include  
# for NDK r8b and later:${ndkroot}/platforms/android-9/arch-arm/usr/include${ndkroot}/sources/cxx-stl/gnu-libstdc++ /4.6/include${ndkroot}/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include


Test

So import OPENCV-2.4.6-ANDROID-SDK sample come in test, note if import when the copy to workspace (preferably not copy, Because many of the code in sample uses the contents of the SDK, and the relative path is taken, it is necessary to add a path to the Jni/include path to the SDK, that is, the relative path of the above green background will not work because of your emigration.



At this point so,apk a also not lack of out, do not need three steps;
Enjoyit,



"supernumerary":

Http://developer.android.com/tools/sdk/ndk/index.html#Installing not only has the various versions of the NDK, the NDK's use is also concise at this address.

For example, there are two ways to use Nativecode:

1). The famous Jni, this method plays the Androidframework advantage, the disadvantage is that we need to compile different libraries (. So) for different platforms, such as Common Arm-eabi, ARMV7, Arm-eabi-withneon and other versions;

2). Nativeactivity, in the android mechanism similar to Java inside the activity life cycle of the callback function (Oncreate/onpause/onresume, etc.), The disadvantage is that it is not possible to use the service and Contentprivider functions directly, and JNI can still be used at this time;

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.