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