Android实战技巧之四十一:制作自己的Android SDK

编译自己的SDK

特种设备会有一些额外的功能,这样就需要给应用层提供特定的API,从而需要定制自己的SDK。
编译自己的sdk还是很简单的,因为google帮我们做好基础工作,步骤如下:

$ source build/envsetup.sh 
$launch 'what you want'
$ make update-api
$ make PRODUCT-sdk-sdk -j8

如果一切顺利的编译完成,那么恭喜你。如果遇到错误也不要紧,因为这是正常的。下面列出我遇到的主要错误:tools/base没有。
error1:

sdk/eclipse/scripts/create_all_symlinks.sh: line 285: cd: tools/base: No such file or directory
...
sdk/eclipse/scripts/create_all_symlinks.sh: line 285: cd: tools/base: No such file or directory
...
sdk/eclipse/scripts/create_all_symlinks.sh: line 47: cd: tools/base: No such file or directory
make: *** [out/host/linux-x86/obj/EXECUTABLES/monitor_intermediates/monitor] Error 1

modify create_all_symlinks.sh
将文件中所有需要tools/base的地方都注释掉。

error2:

sdk/build/tools.atree:124: couldn't locate source file: tools/base/templates/projects
sdk/build/tools.atree:125: couldn't locate source file: tools/base/templates/activities
sdk/build/tools.atree:126: couldn't locate source file: tools/base/templates/gradle
sdk/build/tools.atree:127: couldn't locate source file: tools/base/templates/other
make: *** [out/host/linux-x86/sdk/android-sdk_eng.linc_linux-x86.zip] Error 44

modify tools.atree

$ vim sdk/build/tools.atree
# Templates
#tools/base/templates/projects                  tools/templates/projects
#tools/base/templates/activities                tools/templates/activities
#tools/base/templates/gradle                    tools/templates/gradle
#tools/base/templates/other                     tools/templates/other

再次修改后就离成功不远了,下面是成功的log。

Package SDK: out/host/linux-x86/sdk/android-sdk_eng.linc_linux-x86.zip
SDK: warning: including GNU target out/target/product/generic/system/lib/libgccdemangle.so

使用SDK

将android-sdk_eng.linc_linux-x86.zip解压到你喜欢的目录,在Android Studio的设置如下:
File—>Project Structure—>SDK Location,填写你刚刚解压的目录即可。
试着用自定义的API做测试吧,good luck!

参考:
http://blog.csdn.net/edsam49/article/details/44996353#reply

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值