NDK Learning 4:eclipse HelloWorld

Source: Internet
Author: User

NDK Learning 4:eclipse HelloWorld

1. Configuring the Eclipse NDK Environment ?

Window->preferences->android->ndk

?

2. new Android Project

Right-click on the project Catalog ->android tools-> Add native support

this time the project will be one more JNI Catalogue

?

3. editing Hello.cpp

#include? <stdio.h>

int? Main (int? argc,? Char*?argv[])

{

?? printf ("Hello?" android!\r\n ");

?? return0;

}??

?

4. Set compilation properties to executable

?

5. compiling Build All

when you are finished compiling , The code doesn't have an error. , syntax highlighting and smart hints are also coming out.

also Eclipse will be in Paths and Symbols automatically add these paths

above step correct completion not automatically added not highlighted Error The possible problem is :

Eclipse program directory with spaces ( sinkhole ? ) I've been in this hole for a long time. ? There are wood there )

?

after compiling it, the :

Libs the executable file that generates the corresponding platform schema in the directory

?

?

6. Running

Connection adb?

Create a new makefile? You can also use other script files

?

Script Process :

adb push? press the file into

adb shell chmod Add executable Permissions

adb Shell Execution

error found after Operation , the problem is that the platform is wrong

?

7. Resolving platform Abi issues

in the configuration file, indicate the generated Abi

?

Create a new Application.mk, Enter the following information

App_abi?:=?armeabi-v7a

app_platform?:=?android-14 ??

?

So here's the problem. ABI where to look? ? in the AVD Manager You can view the target version of the ABI

?

Recompile to generate

?

Modify our Make file script at this time :

modale_name?:=? Hello

All

???? Adb?push?. \libs\armeabi-v7a\$ (modale_name)?/data/local/tmp

???? adb? Shell? chmod?755?/data/local/tmp/$ (modale_name)

???? adb? Shell?/data/local/tmp/$ (modale_name)??

?

can run successfully :

?

NDK Learning 4:eclipse HelloWorld

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.