-
Notifications
You must be signed in to change notification settings - Fork 420
Android Development Environment Configuration in Mac OS X
Environment configuration in Mac is a relatively easy job since Mac system integrates Java and Python environment, so we do not need to configure java and python.
Please download a relatively new version NDK and latest version ADT and unzip to appointed directory
NDK download address: http://developer.android.com/tools/sdk/ndk/index.html
ADT download address: http://developer.android.com/sdk/index.html
Open terminal and type ‘pico .bash_profile’, then open the text editor of this file and type the below text:
1 2 3 4 5 6 |
export CROSSAPP_ROOT=/Users/jie/Documents/CrossApp export ANDROID_SDK_ROOT=/Users/jie/Documents/android/adt-bundle-mac/sdk export ANDROID_NDK_ROOT=/Users/jie/Documents/android/android-ndk-r8b export NDK_ROOT=/Users/jie/Documents/android/android-ndk-r8b export PATH=$PATH:$ANDROID_NDK_ROOT export PATH=$PATH:$ANDROID_SDK_ROOT |
Open terminal and build project by following the below commands.
1 2 3 4 |
cd $CROSSAPP_ROOT cd tools cd project-creator ./create_project.py |
1 |
./create_project.py –project MyFirstApp –package com.crossapp.test –language cpp |
Open eclipse, File->Other->Android->Android Project from Existing Code, click Browse, and select proj.android and import android project into eclipse.
After we imported project into eclipse, firstly we need to copy the folders in CrossApp/CrossApp/platform/android/java/src path into project /proj.android/src.
Secondly right click project ->Properties->C/C++ Build->Environment, and click ‘Add’ on the right side to add a variable whose name is NKD_ROOT and value is NDK’s root directory.
When we finished the above steps, we can directly click project ->Run As Android Application and start to compile our project.
Note: the above steps are only valid for creating project in Mac, if you want to debug compiled CrossApp project of Windows in Mac, you need to change Build command in C/C++ Build into bash ${ProjDirPath}/build_native.sh as well as delete import-add-path relative paths in jni/Android.mk that was additionally added in Windows. Please view the steps after importing eclipse in different environments if you want to know the distinction between android development environment configuration in Mac and Windows.
So far, our Android basic environment setting up job is done!