【Android平台】 Alljoyn学习笔记三 开发环境的搭建和Building AllJoyn from Source for Android

BUILD FROM SOURCE - ANDROID

Prerequisites

  • The following content uses many terms and concepts that are described in the Introduction to
    the AllJoyn Framework
    . Therefore, it is strongly recommended that you read the Introduction content first.
  • Before proceeding with development, make sure that you have set up the development environment as described here for Windows or
    for Linux.

Setting Up the Programming Environment

This section explains how to set up the programming environment for developing AllJoyn-enabled Android applications. It covers the following topics:

  • Install the Android SDK and NDK
  • Install Eclipse and the ADT plug-in

NOTE: The procedures described in this section require the specified tool versions.

Installing the Android SDK

The Android software development kit (SDK) provides the tools needed for building Android applications and transferring applications to or from an Android device.The 'adb' tool is used to:

  • Transfer/pull files to/from the phone
  • Run the AllJoyn standalone router
  • Install/uninstall applications

If you want to run AllJoyn on Android 2.2 (Froyo), you can install Android SDK version r9 or above.

If you want to run AllJoyn on Android 2.3 (Gingerbread), you can install at least Android SDK version r11 or above.

Download Android SDK version r11 or above from the following location:

http://developer.android.com/sdk/index.html

Install the SDK by following the directions given on the download page.

In order to run, the SDK requires certain software packages to be pre-installed on your system. For more information, see the following location:

http://developer.android.com/sdk/requirements.html

After installing the SDK, you must install the Android platform support packages you wish to use. See:

http://developer.android.com/sdk/installing.html#AddingComponents

The AllJoyn framework runs on any SDK platform with Android API levels 8 through 11. Note that installing these packages may take some time.

Installing the Android NDK

The Android native development kit (NDK) enables developers to build Java native libraries (JNI libraries) which can be called from Android (Java) applications. Android NDK is required only to write Java native libraries. The Android NDK is not required to
use the Android Java bindings.

The main tool used from the Android NDK is 'ndk-build', which is used to build the native library of the JNI application.

To run Android JNI applications using AllJoyn, install any NDK version 7 or above fromhttp://developer.android.com/tools/sdk/ndk/index.html .

Install the NDK by following the directions given on the download page.

To run, the NDK requires that the following software packages are pre-installed on your system:

  • Latest Android SDK (including all dependencies)
  • GNU Make 3.81 or later
  • Recent version of awk (GNU awk or nawk)

For more information, see the NDK download page.

Installing Eclipse and the ADT plug-in

The Android SDK operates in the Eclipse integrated development environment, with the addition of the Eclipse plug-in for the Android development tools (ADT).

Since Android applications are Java-based, installing Eclipse for Java development may be helpful.

Download Eclipse from the following location:

http://eclipse.org

Install Eclipse by following the directions given on the download page.

Instructions for installing the Eclipse ADT plug-in can be found at the following location:

http://developer.android.com/guide/developing/projects/projects-eclipse.html

NOTE: If the plug-in cannot find the SDK executable, it displays an error and then prompts for its location. (Point it to where you installed the SDK.) Also, if you haven't already selected the packages that need installing (refer to [Installing the Android
SDK][install-android-sdk]), you are prompted to do so upon launching ADT.

Downloading the OpenSSL header files and library

The AllJoyn framework uses the OpenSSL crypto library for end-to-end encryption and authentication.

The prebuilt library is required to link AllJoyn applications. It can be downloaded directly from the Android device or emulator into the lib folder of the AllJoyn distribution. Attach the device (or launch the Android emulator), then run the following commands:

cd <alljoyn_dir>/lib
adb pull /system/lib/libcrypto.so libcrypto.so

The above command means:

adb pull

The library can also be built from the Android source repository. For details on building the Android source tree, see the Android source repository web site:

http://source.android.com/source/download.html

IMPORTANT: If you are building for Froyo, the libcrypto.so library
must be pulled from Froyo, not Gingerbread. Conversely, if you are building for Gingerbread, the libcrypto.so library
must be pulled from Gingerbread.

Building AllJoyn from Source for Android

For most developers, the SDK package available to download from http://allseenalliance.org is sufficient for developing Android
applications using AllJoyn. However, if you wish to obtain and compile AllJoyn from source, follow the directions in this section.

To compile AllJoyn from source, the following items are required:

  • Android SDK
  • Android NDK
  • Eclipse and the ADT plug-in
  • Android source

Instructions for obtaining the Android SDK, Android NDK, Eclipse and the ADT plug-in are in Setting
Up the Programming Environment
.

The Android source

The Android source (http://source.android.com) is required for building Android targets. For most developers, downloading and
building Android source is the most complicated step in building AllJoyn for Android. Google has detailed instructions for downloading and building Android source.

For a list of system requirements and instructions for obtaining the required tools, seehttp://source.android.com/source/initializing.html.

For instructions on obtaining the Android Source Tree, see http://source.android.com/source/downloading.html.

When running the repo init command specify:

  • -b
    froyo-release for Froyo source
  • -b
    gingerbread-release for Gingerbread source

For instructions on building and running the build source, see http://source.android.com/source/building.html

  • Build the "generic" version of Android.
  • There is no need to run the code. Only the build libraries that are not available in the NDK are used.

Obtaining the AllJoyn source

If you followed the instructions in The Android source,
you should have the repo tool and git installed on your system. Enter the following commands to get the AllJoyn source:

$ mkdir $HOME/alljoyn # for example
$ cd $HOME/alljoyn
$ repo init -u git://github.com/alljoyn/manifest.git
$ repo sync
$ repo start master --all

Building the AllJoyn framework for Android

At this point. you have all of the files and programs required to build the AllJoyn framework for Android. The following commands assume you have installed the Android NDK at /usr/local/android-ndk-r5b,
you have downloaded and built the Android source, and it is located in $HOME/android-platform.

IMPORTANT: If you are building for Froyo, the Android source must be built for Froyo, not Gingerbread. Conversely, if you are building for Gingerbread, the Android source must be built for Gingerbread.

Use the following commands to build the AllJoyn framework for Android:

$ export JAVA_HOME="/usr/lib/jvm/java-6-sun" # or java-5-sun
$ export CLASSPATH="/usr/share/java/junit.jar"
$ scons OS=android CPU=arm ANDROID_NDK=/usr/local/android-ndk-r5b
   ANDROID_SRC=$HOME/android-platform WS=off

It is possible to specify that the AllJoyn framework uses additional tools during the build process. For example, the AllJoyn framework can use Uncrustify to check white space compliance and Doxygen for producing API documentation for the C++ APIs. See Configuring
the Build Environment (Linux Platform)
 for detailed instructions for installing these two tools.

[install-android-sdk]: #Installing the Android SDK

原文来自官网,特此声明

时间: 2025-01-20 07:36:36

【Android平台】 Alljoyn学习笔记三 开发环境的搭建和Building AllJoyn from Source for Android的相关文章

VSTO学习笔记(三) 开发Office 2010 64位COM加载项

原文:VSTO学习笔记(三) 开发Office 2010 64位COM加载项 一.加载项简介 Office提供了多种用于扩展Office应用程序功能的模式,常见的有: 1.Office 自动化程序(Automation Executables) 2.Office加载项(COM or Excel Add-In) 3.Office文档代码或模板(Code Behind an Office Document or Template) 4.Office 智能标签(Smart Tags) 本次我们将学习使

Cocos2d-x学习笔记之开发环境搭建_C 语言

要问如今什么比较火,当然是手机app了,随之智能机的普及,不断推出了越来越多的手机app,而游戏其实也是一种app.cocos2d-x一款免费游戏开发引擎,本着开源.跨平台的特色,成为了越来越多的手机游戏的开发引擎,所以让我们也来学习cocos2d-x这款游戏引擎吧.通过学习cocos2d-x,我们将了解更多关于游戏开发的知识,比如lua脚本.Box2d物理引擎.代码设计思想等等.总之,我们并不局限于学习cocos2d-x本身,而是通过学习cocos2d-x,掌握更多的游戏开发经验和技巧.现在就

汇编语言学习笔记-设置开发环境,编写hello world!

我用的IDE是masm32官方网站是:http://www.masm32.com/下载的地址是:http://www.masm32au.com/masm32/m32v10r.zip(这个包适合中国人开发For programmers in Australia, China, South East Asia and the Pacific region.) hello  world的汇编代码如下 代码 .386.model flat,stdcalloption casemap:none inclu

Android源码下载及开发环境的搭建

1.前言         前一博文给自己列了一下Android的学习计划,是时候一个个的完成了.如计划列的,我要写的第一篇是<Android源码 的下载及开发环境的搭建>,致于如何去下载源码,其实网上已经一大堆的帖子了,一搜就有.但在这里,我想说,一个源码的下载,不是简单的把源码下载下来之 样就OK了,就可以开始你的源码学习之旅.要想更好的学习源码和进行开发,一个适合自己的开发环境还是必不可少的,这里我会列出来我给自己准备的开发环境 的做法,不能说明是最优的,但至少我感觉对我来说还是挺方便的.

《Android 平板电脑开发实战详解和典型案例》——1.2节开发环境的搭建

1.2 开发环境的搭建 Android 平板电脑开发实战详解和典型案例 本节开始进入Android的开发,首先介绍开发环境的搭建.开发环境的搭建分为3个步骤:SDK的安装与环境变量配置.Eclipse集成开发环境的搭建.模拟器的创建与使用,下面对其一一进行讲解. 1.2.1 Android SDK的安装与环境变量配置 Android SDK的安装与环境变量配置包括如下几个步骤. (1) 在Oracle的官方网站上,下载相应的JDK软件(网址为:http://www.oracle.com/tech

《Android 应用案例开发大全(第3版)》——第1.3节Android开发环境的搭建

1.3 Android开发环境的搭建 本节主要讲解基于Eclipse的Android开发环境的搭建(包括SDK的下载和SDK的配置).模拟器的创建和运行,以及Android开发环境搭建好之后,对其开发环境进行测试并创建第一个Android应用程序Hello Android等相关知识. 1.3.1 Android SDK的下载 前面已经对Android平台进行了简单的介绍,从本小节开始,将带领读者逐步搭建自己的开发环境.Android SDK是开发Android应用程序的基础开发环境,其本身是免费

《Android 应用案例开发大全(第3版)》——第1章,第1.3节Android开发环境的搭建

1.3 Android开发环境的搭建本节主要讲解基于Eclipse的Android开发环境的搭建(包括SDK的下载和SDK的配置).模拟器的创建和运行,以及Android开发环境搭建好之后,对其开发环境进行测试并创建第一个Android应用程序Hello Android等相关知识. 1.3.1 Android SDK的下载前面已经对Android平台进行了简单的介绍,从本小节开始,将带领读者逐步搭建自己的开发环境.Android SDK是开发Android应用程序的基础开发环境,其本身是免费的,

kvm虚拟化学习笔记(三)之windows kvm虚拟机安装

原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://koumm.blog.51cto.com/703525/1290191 KVM虚拟化学习笔记系列文章列表 ---------------------------------------- kvm虚拟化学习笔记(一)之kvm虚拟化环境安装http://koumm.blog.51cto.com/703525/1288795 kvm虚拟化学习笔记(二)之linux kvm虚拟机安装 h

《Android 应用案例开发大全(第二版)》——1.3节Android开发环境的搭建

1.3 Android开发环境的搭建 Android 应用案例开发大全(第二版) 本节主要讲解基于Eclipse的Android开发环境的搭建,模拟器的创建和运行,以及如何应用DDMS进行程序的调试. 1.3.1 Android SDK的安装及环境变量的配置 Android使用的编程语言是时下最流行的Java高级语言,Java的跨平台性和开源性,极大地促进了Android平台的发展. 首先要安装Java的JDK,并且正确地配置系统的环境变量(基于Windows操作系统).具体步骤如下. (1)