Cocos2d-x learning Tour (4): 1.4 using eclipse to compile Android C ++

Source: Internet
Author: User

Preparation

The android development environment has been configured in the previous chapter. Let's compile and run the hello-JNI example today.

Project path: D: \ android-ndk-r8b \ samples \ hello-JNI

Step 1: import the hello-JNI project to eclipse

Open eclipse and choose File> New> Project> Android project from exsiting code.

Click Next, select the hello-JNI directory in ndk, and click Finish to finish the import.

Now let's take a look at the project file structure. The JNI directory is the c ++ we need to compile.

Deploy hellojni on the android simulator. Right-click the project and choose run as> Android Application. An error occurs during running.

It seems that the cygwin we installed has not been used yet. Now we can use it to compile C ++. Right-click the project, select Properties, open the project properties, and select the builders tab, click new to enable cygwin compiler.

Follow the settings below

Location: D: \ cygwin \ bin \ bash.exe

Working directory: D: \ cygwin \ bin

Arguments: -- login-c "CD/cygdrive/D/android-ndk-r8b/samples/Hello-JNI & ndk-build"

Switch to build options and follow the settings below to clear the compiled so file and generate it again.

Link to the APK file.

Move the ndk_builder to the top

The following figure shows the successful running interface.

Note:

If you have any questions about learning together, please note. For more information, see www.cnblogs.com/dekins.

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.