# Android AIDL全攻略一

**URL:** <https://www.isharkfly.com/t/android-aidl/7556>\
**Category:** 程序语言\
**Created:** [December 4, 2012, 5:04am UTC](https://www.isharkfly.com/t/android-aidl/7556 "2012-12-04T05:04:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![honeymoose](https://www.isharkfly.com/user_avatar/www.isharkfly.com/honeymoose/32/20796_2.png) [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Post date:** [December 4, 2012, 5:04am UTC](https://www.isharkfly.com/t/android-aidl/7556/1 "2012-12-04T05:04:41Z")

</div>

Android的服务开发中我们可能都是Activity和Service同进程处理，但想象过系统提供的各种ServiceManager吗? 比如 SensorManager、SmsManager 这些服务可以提供给任意应用，对于这样的公共后台服务器开发类似我们在Win32的COM组件或Symbian的C/S框架，我们需要AIDL(Android Interface Definition Language即Android接口定义语言)来支持服务IPC(interprocess communication IPC)和各个进程的组件进行通讯。

我们将分5节完成以下几个问题

1. AIDL的概念 (本节)

2. Service绑定

3. AIDL基础框架

4. Parcelable

5. Android开源项目中的AIDL示例分析

使用Win32+Eclipse+ADT开发的网友可以通过在SDK的platform/android-x.y/tools文件夹中找到 aidl.exe 文件，这里android123提醒大家注意的是并不是sdk根目录下的tools文件一定要进入到platform中去，其中android-x.y是相应的sdk版本。我们首先执行无参数的aidl可以看到完整的帮助如图:  
 ![](https://www.isharkfly.com/images/transparent.png)

当然从目前的新版ADT插件来说可以自动的通过AIDL文件生成Java代码，如果使用Ants方式编译可以考虑上面的cmd命令行方式
