安装 android-tools

mkdir ~/android && cd ~/android

wget https://dl.google.com/android/repository/tools_r25.2.3-linux.zip

unzip tools_r25.2.3-linux.zip

配置环境变量

echo 'export ANDROID_HOME=~/android' >> ~/.bashrc

echo 'export PATH=${ANDROID_HOME}/tools/bin:$PATH' >> ~/.bashrc

source ~/.bashrc

以编译https://github.com/drakeet/Ti...为例

git clonehttps://github.com/drakeet/TimeMachine.git

cd TimeMachine

./gradlew build

漫长的等待后错误如下:

FAILURE: Build failed with an exception.

* What went wrong:

A problem occurred configuring project ':timemachine'.

> You have not accepted the license agreements ofthe following SDK components:

[Android SDK Build-Tools 25.0.2, Android SDKPlatform 25].

Before building your project, you need to accept the license agreements and complete the installation ofthe missing components usingthe Android Studio SDK Manager.

Alternatively, to learn how to transfer the license agreements fromone workstation to another, go tohttp://d.android.com/r/studio-ui/export-licenses.html

* Try:

Run with--stacktrace option to get the stack trace. Run with --info or --debugoption to get more log output.

BUILD FAILED

Total time: 2 mins 40.822secs

可以看出是因为缺少[Android SDK Build-Tools 25.0.2, Android SDK Platform 25]
这时执行android list sdk --all寻找匹配的序号

从上图可以看出匹配的是 3
执行android update sdk -u-a -t 3询问时输入 "y" 并耐心等待

Installing Archives:

Preparing to install archives

Downloading Android SDK Build-tools, revision 25.0.2

Installing Android SDK Build-tools, revision 25.0.2

Installed Android SDK Build-tools, revision 25.0.299%)

Done. 1 package installed.

可以看出安装成功,再次执行./gradlew build尝试编译, 报错如下:

root@hostker:~/work/TimeMachine# ./gradlew build

Checking the license for package Android SDK Platform 25in /root/android/licenses

Warning: License for package Android SDK Platform 25not accepted.

FAILURE: Build failed withan exception.

* What went wrong:

A problem occurred configuring project ':timemachine'.

> You have not accepted the license agreements ofthe following SDK components:

[Android SDK Platform 25].

Before building your project, you need to accept the license agreements and complete the installation ofthe missing components usingthe Android Studio SDK Manager.

Alternatively, to learn how to transfer the license agreements fromone workstation to another, go tohttp://d.android.com/r/studio-ui/export-licenses.html

* Try:

Run with--stacktrace option to get the stack trace. Run with --info or --debugoption to get more log output.

BUILD FAILED

Total time: 3.94secs

可以看出是缺少 '[Android SDK Platform 25]',重复上次的过程

从上图可以看出匹配的是 33
执行android update sdk -u-a -t 33询问时输入 "y" 并耐心等待

Installing Archives:

Preparing to install archives

Downloading SDK Platform Android 7.1.1, API 25, revision 3

Installing SDK Platform Android 7.1.1, API 25, revision 3

Installed SDK Platform Android 7.1.1, API 25, revision 396%)

Done. 1 package installed.

可以看出安装成功,再次执行./gradlew build尝试编译, 报错如下:

FAILURE: Build failed with an exception.

* What went wrong:

A problem occurred configuring project ':timemachine'.

> You have not accepted the license agreements ofthe following SDK components:

[Android SDK Platform-Tools].

Before building your project, you need to accept the license agreements and complete the installation ofthe missing components usingthe Android Studio SDK Manager.

Alternatively, to learn how to transfer the license agreements fromone workstation to another, go tohttp://d.android.com/r/studio-ui/export-licenses.html

* Try:

Run with--stacktrace option to get the stack trace. Run with --info or --debugoption to get more log output.

BUILD FAILED

Total time: 4.913secs

android update sdk -u-a -t 2

Installing Archives:

Preparing to install archives

Downloading Android SDKPlatform-tools, revision 25.0.3

Installing Android SDK Platform-tools, revision 25.0.3

Stopping ADB server failed (code -1).

Installed Android SDK Platform-tools, revision 25.0.397%)

Stopping ADB server succeeded.

Starting ADB server succeeded.

Done. 1 package installed.

FAILURE: Build failed with an exception.

* What went wrong:

A problem occurred configuring project ':timemachine'.

> You have not accepted the license agreements ofthe following SDK components:

[Android Support Repository].

Before building your project, you need to accept the license agreements and complete the installation ofthe missing components usingthe Android Studio SDK Manager.

Alternatively, to learn how to transfer the license agreements fromone workstation to another, go tohttp://d.android.com/r/studio-ui/export-licenses.html

* Try:

Run with--stacktrace option to get the stack trace. Run with --info or --debugoption to get more log output.

BUILD FAILED

android update sdk -u-a -t 160

Installing Archives:

Preparing to install archives

Downloading Android SupportRepository, revision 43

Installing Android Support Repository, revision 43

Installed Android Support Repository, revision 4399%)

Done. 1 package installed.

再次尝试编译./gradlew build

FAILURE: Build failed with an exception.

* What went wrong:

Gradle build daemon disappearedunexpectedly (it may have been killed or may have crashed)

* Try:

Run with --stacktrace optiontoget the stack trace. Run with --info or --debug optiontoget more log output.

额... 好像 gradle 进程被杀了,可能我内存太小了吧, 下次换个大点的再试

在服务器上使用grandle打包android源码相关推荐

  1. 服务器android打包,在服务器上使用 gradle 打包 android 源码

    安装 android-tools mkdir ~/android && cd ~/android wget https://dl.google.com/android/reposito ...

  2. Mac上下载及编译android源码

    参考: https://blog.csdn.net/u010963246/article/details/71480684 https://blog.csdn.net/qq_25333681/arti ...

  3. android开发环境建立以及开发工具的使用--怎样使用eclipse来开发android源码

    /** 版本:1.0 日期:2009-04-01 作者:HKjinzhao 备注: 转自:http://blog.csdn.net/hkjinzhao/article/details/4043997 ...

  4. 怎样使用Eclipse来开发Android源码

    怎样使用Eclipse来开发Android源码 用eclipse+ADT作为android开发工具,可以说是很方便的,在HelloActivity小程序里我们就感觉到eclipse功能的强大.那么,我 ...

  5. Android源码的下载,编译,刷机

    上篇说到<framework开发环境搭建>,本篇继续介绍Android源码的下载.编译.刷机 先贴上Android源码官网地址:https://source.android.com/doc ...

  6. 安卓java编辑器eclipse_Eclipse开发Android源码的详细教程

    用eclipse + ADT作为android开发工具,可以说是很方便的,在HelloActivity小程序里我们就感觉到eclipse功能的强大. 1.可以使用eclipse来编辑JAVA程序.检查 ...

  7. Android源码:2、如何下载源码详解(二)(支持移动硬盘、mac)—亲测成功

    文章目录 一.编译环境设置 1.如果移动硬盘需要格式化 2.创建区分大小写的磁盘映像 3.设置文件描述符数量上限 二.Android源码下载更新 (1)安装 .打开Repo (2)替换国内清华的镜像 ...

  8. Android实现车辆检测(含Android源码 可实时运行)

    Android实现车辆检测(含Android源码 可实时运行) 目录 Android实现车辆检测(含Android源码 可实时运行) 1. 前言 2. 车辆检测数据集说明 3. 基于YOLOv5的车辆 ...

  9. Android实现佩戴安全帽检测和识别(含Android源码)

    Android实现佩戴安全帽检测和识别(含Android源码) 目录 Android实现佩戴安全帽检测和识别(含Android源码) 1. 前言 2. 佩戴安全帽检测和识别的方法 (1)基于目标检测的 ...

最新文章

  1. 水木-搜索引擎技术版
  2. python numpy转字符串
  3. 概率整形技术(PCS)介绍
  4. centos7 切换中文输入法 无需安装
  5. qt5.14(vc2015 x64位)的安装配置和vc2015上qobjectdefs的c2134和QColor的c2661编译问题解决
  6. Java 自带的加密类MessageDigest类(加密MD5和SHA)
  7. VBox 快照备份虚拟机
  8. Java设计模式:模板模式
  9. 自然语言处理NLP概论
  10. Linux 服务大全详解
  11. 初期投资60万7-11加盟模式在华将变通
  12. 【SQL注入】SQL注入基本流程
  13. 小学计算机课优质课,2018年武汉市小学信息技术优质课评比
  14. 干净卸载mac上的软件
  15. QOpenGLWidget空白不显示绘图内容
  16. 经常生气的人,身体有什么变化?
  17. Go 每日一库之 gorilla/securecookie
  18. 单连通和多(复)连通
  19. EMC设计的3大规律和3大要素
  20. 图解排序算法之快速排序算法

热门文章

  1. android qq底部菜单栏,怎么关闭手机QQ底部导航栏的“看点”?
  2. CoreImage核心图像图像处理
  3. 操作系统平时练习和测验(3)
  4. xcode mac app_IOS苹果APP签名详解
  5. 安全生产预测预警系统解决方案
  6. 运维之阿里云和本地虚拟机的连接问题
  7. 【JavaScript】移动端扫描二维码检测浏览器(微信、支付宝、Safari、其他浏览器)
  8. 迅时MX100G-S数字中继网关荣获《电信设备进网许可证》
  9. python 尖括号表示什么类型,Python的小括弧,中括号,大括号还有尖括号的区别...
  10. 前端上传文件保存到变量中