当前位置: 代码迷 >> Android >> Android实战技能之四十一:制作自己的Android SDK
  详细解决方案

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

热度:24   发布时间:2016-04-27 22:53:49.0
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 directorymake: *** [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/projectssdk/build/tools.atree:125: couldn't locate source file: tools/base/templates/activitiessdk/build/tools.atree:126: couldn't locate source file: tools/base/templates/gradlesdk/build/tools.atree:127: couldn't locate source file: tools/base/templates/othermake: *** [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.zipSDK: 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

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

  相关解决方案