안드로이드2013. 2. 20. 16:10

글을 올린 블로거를 생각해서 광고 한번만 클릭해주시면 감사하겠습니다

xCode가 깔려있다는 전제하에 진행하겠다 xCode는 mac AppStore에 가서 xCode라고 치면 무료로

다운 받을수 있다.

http://www.macports.org/install.php

Installing MacPorts

MacPorts version 2.1.3 is available in various formats for download and installation (note, if you are upgrading your Mac OS X to a new major release, see the migration info page):

  • “pkg” installers for Mountain LionLion and Snow Leopard, for use with the Mac OS X Installer. This is the simplest installation procedure that most users should follow after meeting the requirements listed below. Installers for legacy platforms Leopard and Tiger are also available.
  • In source form as either a tar.bz2 package or a tar.gz one for manual compilation, if you intend to customize your installation in any way.
  • SVN checkout of the unpackaged sources, if you wish to follow MacPorts development.
  • The selfupdate target of the port(1) command, for users who already have MacPorts installed and wish to upgrade to a newer release.

Checksums for our packaged downloads are contained in the corresponding checksums file.

Please note that in order to install and run MacPorts on Mac OS X, your system must have installations of the following components:

  1. Apple's Xcode Developer Tools (version 4.4 or later for Mountain Lion, 4.1 or later for Lion, 3.2 or later for Snow Leopard, or 3.1 or later for Leopard), found at the Apple Developer Connection site, on your Mac OS X installation CDs/DVD, or in the Mac App Store. Using the latest available version that will run on your OS is highly recommended.
  2. Apple's Command Line Developer Tools are found at the Apple Developer Connection site, or they can be installed from within Xcode 4. Users of Xcode 3 or earlier can install this by ensuring that the appropriate option(s) are selected at the time of Xcode's install ("UNIX Development", "System Tools", "Command Line Tools", or "Command Line Support").
  3. Xcode 4 and later users need to first accept the Xcode EULA by either launching Xcode or running:
    xcodebuild -license
  4. (Optional) The X11 windowing environment for ports that depend on the functionality it provides to run. You have multiple choices for an X11 server:
    • Apple's X11.app is provided by the “X11 User” package (an optional installation on your system CDs/DVD for older OS Versions and provided unconditionally on Lion).
    • Install the xorg-server port from MacPorts.
    • The XQuartz Project provides a complete X11 release for OS X including server and client libraries and applications.

이 화면에서 맨 위에 링크에서 나는 Mountain Lion 을 클릭해서 다운받았다

자기꺼에 맞는것을 다운 받으면 되겠다

macport를 깔고 나면 터미널에 들어가서

sudo port selfupdate 치면 업데이트가 된다 그다음에

sudo port install gmake gwak 치면 설치가 된다

터미널에서 안될경우 다시 터미널을 껏다 키면 된다


이제 ndk를 다운 받으러 사이트에 들어간다

http://developer.android.com/tools/sdk/ndk/index.html 여기서

Mac OS X (intel)android-ndk-r8d-darwin-x86.tar.bz2308328942 bytes5cd9ef9fb7e03943ee8c9e147e42e571
다운을 받는다

나 같은 경우에는 도큐멘트에 압축을 풀었다

그 다음 터미널에 들어가서

ls -al 치면 .bash_profile이 없을것이다.

vi .bash_profile 치고 들어가서 i 를 눌러 

export PATH=${PATH}:/Users/best/Documents/android-ndk-r8d/

best는 계정명이다 자기 계정명으로 바꾸어준다

그리고 나서 esc를 누르고 :wq를 치고 return을 쳐서 빠져나온다

ls -al 이라고 치면 .bash_profile 생성되어 잇는것을 확인할 수 있다.

이제 샘플을 빌드해보자

cd Documents/android-ndk-r8d/samples/hello-jni/jni/ 이렇게 친 다음에

ndk-build라고 치면 

이렇게 so 파일이 만들어지면 정상적으로 빌드가 된 것이다

Posted by 퍼플카우D