【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


原文来自官网,特此声明

相关文章
|
4月前
|
监控 Android开发 数据安全/隐私保护
批量发送短信的平台,安卓群发短信工具插件脚本,批量群发短信软件【autojs版】
这个Auto.js脚本实现了完整的批量短信发送功能,包含联系人管理、短信内容编辑、发送状态监控等功能
|
Java 开发工具 Android开发
Android与iOS开发环境搭建全解析####
本文深入探讨了Android与iOS两大移动操作系统的开发环境搭建流程,旨在为初学者及有一定基础的开发者提供详尽指南。我们将从开发工具的选择、环境配置到第一个简单应用的创建,一步步引导读者步入移动应用开发的殿堂。无论你是Android Studio的新手还是Xcode的探索者,本文都将为你扫清开发道路上的障碍,助你快速上手并享受跨平台移动开发的乐趣。 ####
|
Java Android开发 Swift
安卓与iOS开发对比:平台选择对项目成功的影响
【10月更文挑战第4天】在移动应用开发的世界中,选择合适的平台是至关重要的。本文将深入探讨安卓和iOS两大主流平台的开发环境、用户基础、市场份额和开发成本等方面的差异,并分析这些差异如何影响项目的最终成果。通过比较这两个平台的优势与挑战,开发者可以更好地决定哪个平台更适合他们的项目需求。
303 1
|
8月前
|
存储 编解码 监控
Android平台GB28181执法记录仪技术方案与实现
本文介绍了大牛直播SDK的SmartGBD在执法记录仪场景中的应用。GB28181协议作为视频监控联网的国家标准,为设备互联互通提供规范。SmartGBD专为Android平台设计,支持音视频采集、编码与传输,具备自适应算法和多功能扩展优势。文章分析了执法记录仪的需求,如实时音视频传输、设备管理及数据安全,并详细阐述了基于SmartGBD的技术实现方案,包括环境准备、SDK集成、设备注册、音视频处理及功能扩展等步骤。最后展望了SmartGBD在未来智慧物联领域的广阔应用前景。
440 13
|
8月前
|
存储 编解码 开发工具
Android平台毫秒级低延迟HTTP-FLV直播播放器技术探究与实现
本文详细探讨了在Android平台上实现HTTP-FLV播放器的过程。首先介绍了FLV格式的基础,包括文件头和标签结构。接着分析了HTTP-FLV传输原理,通过分块传输实现流畅播放。然后重点讲解了播放器的实现步骤,涵盖网络请求、数据解析、音视频解码与渲染,以及播放控制功能的设计。文章还讨论了性能优化和网络异常处理的方法,并总结了HTTP-FLV播放器的技术价值,尤其是在特定场景下的应用意义。
377 11
|
8月前
|
监控 Shell Linux
Android调试终极指南:ADB安装+多设备连接+ANR日志抓取全流程解析,覆盖环境变量配置/多设备调试/ANR日志分析全流程,附Win/Mac/Linux三平台解决方案
ADB(Android Debug Bridge)是安卓开发中的重要工具,用于连接电脑与安卓设备,实现文件传输、应用管理、日志抓取等功能。本文介绍了 ADB 的基本概念、安装配置及常用命令。包括:1) 基本命令如 `adb version` 和 `adb devices`;2) 权限操作如 `adb root` 和 `adb shell`;3) APK 操作如安装、卸载应用;4) 文件传输如 `adb push` 和 `adb pull`;5) 日志记录如 `adb logcat`;6) 系统信息获取如屏幕截图和录屏。通过这些功能,用户可高效调试和管理安卓设备。
|
11月前
|
IDE 开发工具 Android开发
移动应用开发之旅:探索Android和iOS平台
在这篇文章中,我们将深入探讨移动应用开发的两个主要平台——Android和iOS。我们将了解它们的操作系统、开发环境和工具,并通过代码示例展示如何在这两个平台上创建一个简单的“Hello World”应用。无论你是初学者还是有经验的开发者,这篇文章都将为你提供有价值的信息和技巧,帮助你更好地理解和掌握移动应用开发。
285 17
|
11月前
|
Java 开发工具 Android开发
安卓与iOS开发环境对比分析
在移动应用开发的广阔天地中,安卓和iOS两大平台各自占据半壁江山。本文深入探讨了这两个平台的开发环境,从编程语言、开发工具到用户界面设计等多个角度进行比较。通过实际案例分析和代码示例,我们旨在为开发者提供一个清晰的指南,帮助他们根据项目需求和个人偏好做出明智的选择。无论你是初涉移动开发领域的新手,还是寻求跨平台解决方案的资深开发者,这篇文章都将为你提供宝贵的信息和启示。
210 8
|
开发工具 Android开发 开发者
Android开发环境搭建
如何搭建Android开发环境,包括下载和安装Android Studio、配置SDK、创建新的Android工程项目等。
367 0
Android开发环境搭建
|
Linux API 开发工具
FFmpeg开发笔记(五十九)Linux编译ijkplayer的Android平台so库
ijkplayer是由B站研发的移动端播放器,基于FFmpeg 3.4,支持Android和iOS。其源码托管于GitHub,截至2024年9月15日,获得了3.24万星标和0.81万分支,尽管已停止更新6年。本文档介绍了如何在Linux环境下编译ijkplayer的so库,以便在较新的开发环境中使用。首先需安装编译工具并调整/tmp分区大小,接着下载并安装Android SDK和NDK,最后下载ijkplayer源码并编译。详细步骤包括环境准备、工具安装及库编译等。更多FFmpeg开发知识可参考相关书籍。
440 0
FFmpeg开发笔记(五十九)Linux编译ijkplayer的Android平台so库
下一篇
oss云网关配置