IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

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

    lincyang发表于 2015-09-21 18:05:24
    love 0

    编译自己的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



沪ICP备19023445号-2号
友情链接