码迷,mamicode.com
首页 > 移动开发 > 详细

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

时间:2015-09-22 10:25:20      阅读:237      评论:0      收藏:0      [点我收藏+]

标签:sdk   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

版权声明:本文为博主原创文章,未经博主允许不得转载。

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

标签:sdk   android   定制sdk   

原文地址:http://blog.csdn.net/lincyang/article/details/48630185

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!