安装 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 clone https://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 of the following SDK components:
[Android SDK Build-Tools 25.0.2, Android SDK Platform 25].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 2 mins 40.822 secs
可以看出是因为缺少 [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 25 in /root/android/licenses
Warning: License for package Android SDK Platform 25 not accepted.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':timemachine'.
> You have not accepted the license agreements of the following SDK components:
[Android SDK Platform 25].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 3.94 secs
可以看出是缺少 '[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 of the following SDK components:
[Android SDK Platform-Tools].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 4.913 secs
android update sdk -u -a -t 2
Installing Archives:
Preparing to install archives
Downloading Android SDK Platform-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 of the following SDK components:
[Android Support Repository].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
android update sdk -u -a -t 160
Installing Archives:
Preparing to install archives
Downloading Android Support Repository, 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 disappeared unexpectedly (it may have been killed or may have crashed)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
额... 好像 gradle 进程被杀了,可能我内存太小了吧, 下次换个大点的再试 

转载于:https://www.cnblogs.com/a00ium/p/7171179.html

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

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

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

  2. 在服务器上使用grandle打包android源码

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

最新文章

  1. 基本CSS选择器,复合选择器,后代选择器
  2. 今天且明白父母为什么生死度外的让孩子们读书
  3. jupyter notebook界面颜色jt_更改jupyter notebook主题颜色——步骤详解(Windows系统)...
  4. linux nfs 权限设置,Linux NFS server 配置
  5. Spring Web Flow 入门demo(二)与业务结合 附源码
  6. Alpine Linux详解
  7. SQL-Server使用点滴(一-数据对象篇)
  8. 图像算法移植到DSP及其优化步骤
  9. 【Elasticsearch】Fielddata is disabled on text field fielddata=true
  10. mysql运用索引写出高效sql_从SQL Server到MySql(5) : 高性能的MySql 索引策略
  11. Telnet 网络设备分页
  12. 初级Java程序员如何快速提升自己的能力?
  13. matlab绘制离散信号结论,实验二 离散时间信号的表示及运算
  14. iOS7官方推荐图标和图像尺寸
  15. CSS W3C 统一验证工具和压缩
  16. 不要时刻忘记保持微笑
  17. 微信小程序之滑动果冻效果
  18. 中医针灸学综合练习题库【11】
  19. 项目管理pmp学习中的记录
  20. rap2搭建,mysql,redis,nginx安装,node环境安装,rap2安装

热门文章

  1. maven setting 设置jdk版本
  2. 高通似乎成了台积电和三星在先进工艺上暗战主角
  3. Windows Azure 系列-- Azure Queue的操作
  4. iterator总结(未完)
  5. ASP.NET 3.5 开发大全DOC版
  6. 10月第3周安全回顾:恶意软件肆虐 Web安全重点关注
  7. ecshop send.php on line 71,搭建LNMP发布ecshop系统及压测启用opcache缓存与否的情况
  8. c语言熵值法,干货 | R语言熵值法详解(附代码) 秒懂自定义函数
  9. python绘制小狗_用Python画一只有点方的小狗狗——turtle库基础入门
  10. access怎么查询工龄_电子商务专业怎么样?学什么?前景好吗?