多快好省的开发待看

linux 安装Android Sdk

2018-12-25  本文已影响7人  hewking
  1. 下载SDK

注意:这里有一个很坑的情况。官网里面的linux 仅限命令行工具还不知道是什么情况,下载下来并且解压只是tools ,是sdk 的tools 目录。虽然只有这个就行了,但是现在并不知道如何使用

这些sdk资源在哪里获取呢? Android 资源网

  1. 安装SDK
  1. 配置SDK
vim /etc/profile

export ANDROID_HOME=/usr/local/android-sdk-linux
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH

注意: 目前一般的android project 都会自带 wrapper 目录,里面带有gradle,项目根目录还有脚本,所以一般运行的时候不需要去下载gradle。android studio 配置gradle 插件即可。如果项目中没有gradle,也没有as 则需要下载gradle。

步骤如下:1.下载gradle wget https://services.gradle.org/distributions/gradle-2.12-bin.zip 2.解压 unzip gradle-2.12-bin.zip 3.配置环境变量 GRADLE_HOME=HOME/gradle export PATH=PATH:$GRADLE_HOME/bin 4. source /etc/profile 5. 输入gradle 检测是否安装成功

5.在./gradlew assembleRelease 编译到时候,可能出现

You have not accepted the license agreements of the following SDK components: [Android SDK Build-Tools 24, Android SDK Platform 24]. 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

这是因为缺少组件导致的,这里是缺少 platform android-28。所以需要安装

android list sdk --all

找到自己缺失组件比如android-28 的代号,并且安装

5.参考资源

Ubuntu下全命令行搭建Android开发环境

Linux 配置Android SDK

Linux -- 安装配置Android SDK

[missing licences的问题](Automatically accept all SDK licences)

组件缺失问题

上一篇 下一篇

猜你喜欢

热点阅读