安装 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
 
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 进程被杀了,可能我内存太小了吧, 下次换个大点的再试 

在服务器上使用 gradle 打包 android 源码的更多相关文章

  1. 2014年最新720多套Android源码2.0GB免费一次性打包下载

    之前发过一个帖子,但是那个帖子有点问题我就重新发一个吧,下面的源码是我从今年3月份开始不断整理源码区和其他网站上的android源码,目前总共有720套左右,根据实现的功能被我分成了100多个类,总共 ...

  2. 【转】Ubuntu10.04上编译Android源码(Build Android source in Ubuntu10.04 Platform)

    原文网址:http://blog.csdn.net/chenyafei617/article/details/6570928 一.Introduction 今天我们就来谈谈如何在Ubuntu平台上面编 ...

  3. APK 的前世今生:从 Android 源码到 apk 的编译打包流程

    最近想要研究热修复的原理,并自己实现一套简单的热修复框架(音视频的坑刚挖好就又挖另一个坑了2333),已经在看书入门 c++,方便后续查看业内一些知名热修复框架的源码,另外在涉及编译期/运行时修改代码 ...

  4. Android源码浅析(三)——Android AOSP 5.1.1源码的同步sync和编译make,搭建Samba服务器进行更便捷的烧录刷机

    Android源码浅析(三)--Android AOSP 5.1.1源码的同步sync和编译make,搭建Samba服务器进行更便捷的烧录刷机 最近比较忙,而且又要维护自己的博客,视频和公众号,也就没 ...

  5. 从 Android 源码到 apk 的编译打包流程

    文中涉及到的工具所在目录:Android/sdk/build-tools.下面开始分解并逐步实现对源码的打包. 编译流程 1. 生成仅包含资源文件的 apk 包和 R.java 文件 根据资源文件和 ...

  6. 在Mac mini上编译Android源码

    参考文章 1.Android 6.0 源代码编译实践 2.编译Android源码致命错误解决方案 实践过程 1.Mac下安装Ubuntu双系统 (1)Ubuntu版本:Ubuntu 15.10 注:实 ...

  7. macOS(Sierra 10.12)上Android源码(AOSP)的下载、编译与导入到Android Studio

    @import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/c ...

  8. 在ubuntu16.04上编译android源码【转】

    本文转载自:http://blog.csdn.net/fuchaosz/article/details/51487585 1 前言 经过3天奋战,终于在Ubuntu 16.04上把Android 6. ...

  9. Android源码的编译和下载【转】

    本文转载自:http://blog.csdn.net/banketree/article/details/9089827 网上介绍下载.编译Android方法一坨,读万卷书不如行万里路,以下是笔者亲身 ...

随机推荐

  1. java 多线程系列基础篇(十一)之生产消费者问题

    1. 生产/消费者模型 生产/消费者问题是个非常典型的多线程问题,涉及到的对象包括“生产者”.“消费者”.“仓库”和“产品”.他们之间的关系如下:(01) 生产者仅仅在仓储未满时候生产,仓满则停止生产 ...

  2. Oracle 设置主键自增长__Oracle

    转自:https://yq.aliyun.com/ziliao/258074 如果想在Oracle数据库里实现数据表主键自增,我们似乎没有办法像MySql般直接定义列的属性来实现.不过对于这个数据库的 ...

  3. Shell编程进阶 2.0 shell中断继续退出

    break    continue   exit break 结束本次for循环 写个for循环脚本 vim for2.sh #!/bin/bash ## 5` do echo $i ] then b ...

  4. Android Binder 系统学习笔记(一)Binder系统的基本使用方法

    1.什么是RPC(远程过程调用) Binder系统的目的是实现远程过程调用(RPC),即进程A去调用进程B的某个函数,它是在进程间通信(IPC)的基础上实现的.RPC的一个应用场景如下: A进程想去打 ...

  5. C语言学习笔记--指针概念

    指针也是一种变量,占有内存空间,用来保存内存地址,在32位系统中指针的占用的内存大小为4个字节 1.*号的意义 (1)在指针声明时,*号表示所声明的变量为指针 (2)在指针使用时,*号表示取指针所指向 ...

  6. DAY7-面向对象之封装

    一.引子 从封装本身的意思去理解,封装就好像是拿来一个麻袋,把小猫,小狗,小王八,还有alex一起装进麻袋,然后把麻袋封上口子.照这种逻辑看,封装=‘隐藏’,这种理解是相当片面的 二.先看如何隐藏 在 ...

  7. C#如何拿到从http上返回JSON数据?

    第一章:C#如何拿到从http上返回JSON数据? 第二章:C#如何解析JSON数据?(反序列化对象) 第三章:C#如何生成JSON字符串?(序列化对象) 第四章:C#如何生成JSON字符串提交给接口 ...

  8. C# WinForm中如何让当前应用程序只允许启动一个实例

    我们在WinForm开发中,很多情况下是需要只允许让用户运行一个实例,那么代码其实很简单.只需要修改Program.cs文件,代码如下 static class Program { /// <s ...

  9. IntelliJ IDEA 导入Project

    一.方式一 File---->Close Project 这样的户每次需要import,都要close一次,非常不方便,如果能在File下面岂不是更好? 二.方式二 File---->Se ...

  10. java判断姓是否合格 千家姓

    package com.sycx.domain; import java.lang.reflect.Array; public class FirstName { public static bool ...