Chinaunix首页 | 论坛 | 博客
  • 博客访问: 90560
  • 博文数量: 10
  • 博客积分: 1430
  • 博客等级: 上尉
  • 技术积分: 201
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-08 00:20
文章分类

全部博文(10)

文章存档

2010年(8)

2009年(1)

2008年(1)

我的朋友

分类: LINUX

2010-04-16 13:32:14

1. Regular Environment Configuration

1.1   Requir DevelopmentTools

Java SDK 1.60 or later

Eclipse IDE for Java V3.4 or later     

(URL: )

Android SDK           

(URL:)

Android ADT                 

(URL: )

1.2   Set Environment Variables

1)      Install JDK to the root dir of disk, and the path must be no whitespace.

2)      Unpack Eclipse IDE and Android SDK to a safe location on your machine.

3)      Set environment vars:

On linux: edit your “~/.bash_profile” or “~/.bashrc” file.Look for a line that sets the PATH environment variable and add the full path to the “…/tools/” directory to it.if the file has not a line setting the path, then you can add it:

       export PATH=${PATH}:/tools

On windows:right-click on My Computer, and select properties.Under the advanced tab, click the environment variables button,and in the dialog that comes up, double-click on Path(Under system variables).Add the full path  to the “…/tools/” dierctory to the path.

4)      Edit the Eclipse’s eclipse.ini file, input:

        -vm

        D:/sun/sdk/jdk/jre/bin/javaw.exe

 

1.3   Install ADT plugin

1)      Start Eclipse, then select Help > Software Updates.... In the dialog that appears, click the Available Software tab.

2)      Click “Add Site…”

3)      In the Add Site dialog that appears, enter this URL in the "Location" field:

         
Note: If you have trouble acquiring the plugin, try using "http" in the Location URL, instead of "https" (https is preferred for security reasons)

4)       Back in the Available Software view, you should see the plugin listed by the URL, with "Developer Tools" nested within it. Select the checkbox next to Developer Tools and click Install...

5)       On the subsequent Install window, "Android DDMS" and "Android Development Tools" should both be checked. Click Next.

6)       Read and accept the license agreement, then click Finish.

7)       Restart Eclipse.

 

1.4   Configure the ADT plugin

1)      Select Window > Preferences... to open the Preferences panel.

2)      Select Android from the left panel.

3)      For the SDK Location in the main panel, click Browse... and locate your downloaded SDK directory.

4)      Click Apply, then OK.

        

Note:If you cann’t see any Android item,then you can to install or update Android SDK:

Start Eclipse, select “Run->Open Run Dialog->Target”, hit “Manager…”, and then select “Install Packages->Update All”.

2. Cross Compile Environment Configuration

2.1   Require Development Tools

1)      Java SDK 1.60 or later

2)      Eclipse IDE for Java V3.4 or later  

3)      Android SDK       

4)      Android ADT                    

5)      Android NDK

(URL: )

6)      For Windows,the recent release of cygwin is required.

(URL: )

2.2       Install NDK

1)      Unpack NDK to a safe location on your machine,such as:

d: /android-ndk-1.5_r1.

2)      Install cygwin: you must be select the gcc and make of development package.

3)      Modify the .base_profile file, add the following line:

NDK_ROOT=/cygdrive/d/android-ndk-1.5_r1
export NDK_ROOT

           Note:’d’ of path represent the NDK’s currently disk

4)      Restart cygwin

5)      Run the following command:

cd ${NDK_ROOT}

./build/host-setup.sh

6)      It’s done.

2.3   Compile sample for test

1)      Start cygwin

2)      Run the following command:

cd ${NDK_ROOT}

make APP=hello-jni

3)      Build the libhello-jni.so file at the

$NDK_ROOT/apps/hello-jni/project/libs/armeabi path.

4)      Start Eclipse(include ADT), create a exist android project,select

“D:\\android-ndk-1.5_r1\\apps\\hello-jni\\project”,click RUN

5)      If success, you will see that a emulator is started, and start android os, and then you can see “Hello from JNI!”.

阅读(695) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~