编译自己的android sdk,Android Automotive开发之一《编译自己的SDK 》

Copyright (C) 2009The Android Open Source Project

Licensed under the Apache License, Version2.0 (the "License");

you may not use thisfile except incompliance with the License.

You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to inwriting, software

distributed under the License is distributed on an"AS IS"BASIS,

WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the Licenseforthe specific language governing permissions and

limitations under the License.

Subject: How to build an Android SDK&ADT Eclipse plugin.

Date:2009/03/27Updated:2015/09/09Table of content:0-License1-Foreword2- Building an SDK forMacOS and Linux3- Building an SDK forWindows4- Building an ADT plugin forEclipse5-Conclusion----------

0-License----------Copyright (C)2009The Android Open Source Project

Licensed under the Apache License, Version2.0 (the "License");

you may not use thisfile except incompliance with the License.

You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to inwriting, software

distributed under the License is distributed on an"AS IS"BASIS,

WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the Licenseforthe specific language governing permissions and

limitations under the License.-----------

1-Foreword-----------This document explains how to build the Android SDK and the ADT Eclipse plugin.

It is designedfor advanced users which are proficient with command-line

operations and know how to setup the pre-required software.

Basically it‘s not trivial yet when done right it‘s not that complicated.--------------------------------------

2- Building an SDK forMacOS and Linux--------------------------------------First, setup your development environment and get the Android source code from

git as explained here:

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

For example forthe cupcake branch:

$mkdir ~/my-android-git

$ cd~/my-android-git

$ repo init-u https://android.googlesource.com/platform/manifest -b master -g all,-notdefault,tools

$ repo syncThen once you have all the source, simply build the SDK using:

$ cd~/my-android-git

$ . build/envsetup.sh$ lunch sdk-eng

$makesdk

This will take awhile, maybe between 20minutes and several hours depending on

your machine. After awhile you‘ll see this in the output:

Package SDK: out/host/darwin-x86/sdk/android-sdk_eng._mac-x86.zipSome options:- Depending on your machine you can tell ‘make‘ to build more things inparallel, e.g.if you have a dual core, use "make -j4 sdk"to build faster.- You can define "BUILD_NUMBER"to control the build identifier that gets

incorporatedinthe resulting archive. The default is to use your username.

One suggestion is to include thedate, e.g.:

$ export BUILD_NUMBER=${USER}-`date +%Y%m%d-%H%M%S`

There are certain characters you should avoidinthe build number, typically

everything that might confuse‘make‘ or your shell. So forexample avoid

punctuation and characters like $& : / \ < >, and .------------------------------

3- Building an SDK forWindows------------------------------Full Windows SDK builds are now only supported on Linux--most of the

framework is not designed to be built on Windows so technically the Windows

SDK is build on top of a Linux SDK where a few binaries are replaced. So it

cannot be built on Windows, and it cannot be built on Mac, only on Linux.

I‘ll repeat this again because it‘s important:

To build the Android SDKfor Windows, you need to use a *Linux*box.

A- Pre-requisites-----------------Before you can even think of building the Android SDKforWindows, you need to

perform the steps from section"2- Building an SDK for MacOS and Linux"above:

setup and build a regular Linux SDK. Once this working, please continue here.

Under Ubuntu, you will need the following extra packages:

$sudo apt-get installtofrodos

tofrodos adds a unix2dos command

B-Building-----------To build, perform the following steps:

$ . build/envsetup.sh$ lunch sdk-eng

$makewin_sdk

Note that this will build both a Linux SDKthena Windows SDK.

The result is located at

out/host/windows/sdk/android-sdk_eng.${USER}_windows/C-Building just the tools--------------------------------------You can also build isolated windows tools directly on Linux without building

the full SDK.

To build, perform the following steps:

$ cd~/my-android-git

$ . build/envsetup.sh$ lunch sdk-eng

$make winsdk-tools

A specific tool can be built using:

$makehost_cross_adb

Then the binaries are located at

out/host/windows-x86/bin/adb.exe-------------------------------------

4- Building an ADT plugin forEclipse-------------------------------------We‘ve simplified the steps here.

It used to be that you‘d have to download a specific version of

Eclipse and install it at a special location. That‘s not needed

anymore.

Instead you just change directories to your git repository and invoke the

build script by giving it a destination directory and an optional build number:

$mkdir ~/mysdk

$ cd~/my-android-git #

The first argument is the destination directory. It must be absolute. Do not

give a relative destination directory such as"../mysdk" -- this would makethe

Eclipse build fail with a cryptic message:

BUILD SUCCESSFUL

Totaltime: 1 minute 5seconds**** Package in ../mysdk

Error: Build failed to produce ../mysdk/android-eclipse

Aborting

The second argument is the build"number". The example used "$USER"but it

really is afreeidentifier of your choice. It cannot contain spaces nor

periods (dashes are ok.) If the build number is missing, a build timestamp will

be used insteadinthe filename.

The build should take something like5-10minutes.

When the build succeeds, you‘ll see something like this at the end of the

output:

ZIP of Update site available at~/mysdk/android-eclipse-v200903272328.zipor

ZIP of Update site available at~/mysdk/android-eclipse-.zipWhen you load the plugininEclipse, its feature and plugin name will look like"com.android.ide.eclipse.adt_0.9.0.v200903272328-.jar". The

internal plugin ID is always composed of the package, the build timestamp andthen your own build identifier (a.k.a. the "build number"), ifprovided. This

means successive builds with the same build identifier are incremental and

Eclipse will know how to update tomorerecent ones.-------------

5-Conclusion-------------This completes the howto guide on building your own SDK and ADT plugin.

Feedback is welcome on the public Android Open Source forums:

http://source.android.com/discuss

If you are upgrading from a pre-cupcake to a cupcake or later SDK please read

the accompanying document"howto_use_cupcake_sdk.txt".-end-

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
提供的源码资源涵盖了安卓应用、小程序、Python应用和Java应用等多个领域,每个领域都包含了丰富的实例和项目。这些源码都是基于各自平台的最新技术和标准编写,确保了在对应环境下能够无缝运行。同时,源码中配备了详细的注释和文档,帮助用户快速理解代码结构和实现逻辑。 适用人群: 这些源码资源特别适合大学生群体。无论你是计算机相关专业的学生,还是对其他领域编程感兴趣的学生,这些资源都能为你提供宝贵的学习和实践机会。通过学习和运行这些源码,你可以掌握各平台开发的基础知识,提升编程能力和项目实战经验。 使用场景及目标: 在学习阶段,你可以利用这些源码资源进行课程实践、课外项目或毕业设计。通过分析和运行源码,你将深入了解各平台开发的技术细节和最佳实践,逐步培养起自己的项目开发和问题解决能力。此外,在求职或创业过程中,具备跨平台开发能力的大学生将更具竞争力。 其他说明: 为了确保源码资源的可运行性和易用性,特别注意了以下几点:首先,每份源码都提供了详细的运行环境和依赖说明,确保用户能够轻松搭建起开发环境;其次,源码中的注释和文档都非常完善,方便用户快速上手和理解代码;最后,我会定期更新这些源码资源,以适应各平台技术的最新发展和市场需求。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值