在Linux下使用gradle自動打包

来源:http://www.cnblogs.com/chenpingzhao/archive/2016/07/07/5651347.html
-Advertisement-
Play Games

一、下載軟體包 1、下載地址 二、安裝 1、java 2、Android sdk 查看源 根據需要進行安裝 如果google很慢,可以改hosts 3、gradle 加入環境變數 三、編譯測試 參考網址 http://askubuntu.com/questions/464755/how-to-ins ...


一、下載軟體包

1、下載地址

wget https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
wget http://services.gradle.org/distributions/gradle-2.12-bin.zip

二、安裝

1、java

sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk
sudo update-alternatives --config java
sudo update-alternatives --config javac

2、Android sdk

./android list sdk

查看源

Refresh Sources:
  Fetching https://dl.google.com/android/repository/addons_list-2.xml
  Validate XML
  Parse XML
  Fetched Add-ons List successfully
  Refresh Sources
  Fetching URL: https://dl.google.com/android/repository/repository-11.xml
  Validate XML: https://dl.google.com/android/repository/repository-11.xml
  Parse XML:    https://dl.google.com/android/repository/repository-11.xml
  Fetching URL: https://dl.google.com/android/repository/addon.xml
  Validate XML: https://dl.google.com/android/repository/addon.xml
  Parse XML:    https://dl.google.com/android/repository/addon.xml
  Fetching URL: https://dl.google.com/android/repository/glass/addon.xml
  Validate XML: https://dl.google.com/android/repository/glass/addon.xml
  Parse XML:    https://dl.google.com/android/repository/glass/addon.xml
  Fetching URL: https://dl.google.com/android/repository/extras/intel/addon.xml
  Validate XML: https://dl.google.com/android/repository/extras/intel/addon.xml
  Parse XML:    https://dl.google.com/android/repository/extras/intel/addon.xml
  Fetching URL: https://dl.google.com/android/repository/sys-img/android/sys-img.xml
  Validate XML: https://dl.google.com/android/repository/sys-img/android/sys-img.xml
  Parse XML:    https://dl.google.com/android/repository/sys-img/android/sys-img.xml
  Fetching URL: https://dl.google.com/android/repository/sys-img/android-wear/sys-img.xml
  Validate XML: https://dl.google.com/android/repository/sys-img/android-wear/sys-img.xml
  Parse XML:    https://dl.google.com/android/repository/sys-img/android-wear/sys-img.xml
  Fetching URL: https://dl.google.com/android/repository/sys-img/android-tv/sys-img.xml
  Validate XML: https://dl.google.com/android/repository/sys-img/android-tv/sys-img.xml
  Parse XML:    https://dl.google.com/android/repository/sys-img/android-tv/sys-img.xml
  Fetching URL: https://dl.google.com/android/repository/sys-img/google_apis/sys-img.xml
  Validate XML: https://dl.google.com/android/repository/sys-img/google_apis/sys-img.xml
  Parse XML:    https://dl.google.com/android/repository/sys-img/google_apis/sys-img.xml
Packages available for installation or update: 22
   1- SDK Platform Android 4.4.2, API 19, revision 4
   2- SDK Platform Android 4.3.1, API 18, revision 3
   3- SDK Platform Android 4.2.2, API 17, revision 3
   4- SDK Platform Android 4.1.2, API 16, revision 5
   5- SDK Platform Android 4.0.3, API 15, revision 5
   6- Google APIs, Android API 23, revision 1
   7- Google APIs, Android API 22, revision 1
   8- Google APIs, Android API 21, revision 1
   9- Google APIs, Android API 19, revision 20
  10- Glass Development Kit Preview, Android API 19, revision 11
  11- Google APIs, Android API 18, revision 4
  12- Google APIs, Android API 17, revision 4
  13- Google APIs, Android API 16, revision 4
  14- Google APIs, Android API 15, revision 3
  15- GPU Debugging tools, revision 3.1
  16- GPU Debugging tools, revision 1.0.3
  17- Android Auto Desktop Head Unit emulator, revision 1.1
  18- Google Play APK Expansion library, revision 1
  19- Google Play Licensing Library, revision 1
  20- Google Play Billing Library, revision 5
  21- Android Auto API Simulators, revision 1
  22- Google Web Driver, revision 2

根據需要進行安裝

./android update sdk --no-ui --filter 1,31,tool,platform-tool

如果google很慢,可以改hosts  

74.125.237.1 dl-ssl.google.com

3、gradle 

加入環境變數

export PATH=/mnt/javasrc/gradle-2.12/bin:/mnt/javasrc/android-sdk-linux:$PATH

三、編譯測試

gradle assRelease
gradle clean

  

參考網址

http://askubuntu.com/questions/464755/how-to-install-openjdk-8-on-14-04-lts

https://developer.android.com/studio/index.html#downloads

http://blog.csdn.net/catoop/article/details/7618099

http://ftp.gnu.org/gnu/glibc/

http://my.oschina.net/zhangxu0512/blog/262275

http://www.cnblogs.com/killkill/archive/2010/08/23/1806468.html

http://openjdk.java.net/install/

https://www.unixmen.com/install-oracle-java-jdk-8-centos-76-56-4/

http://stackoverflow.com/questions/31182240/what-exactly-is-tools-jar-in-the-android-sdk

http://tecadmin.net/install-oracle-java-8-jdk-8-ubuntu-via-ppa/


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 基於物品的協同過濾演算法ItemCF 基於item的協同過濾,通過用戶對不同item的評分來評測item之間的相似性,基於item之間的相似性做出推薦。簡單來講就是:給用戶推薦和他之前喜歡的物品相似的物品。 用例說明: 註:基於物品的協同過濾演算法,是目前商用最廣泛的推薦演算法。 剛開始看這個用例,感覺還 ...
  • IDENT_CURRENT('TableName')為當前的最大標識值,IDENT_INCR('TableName')為設置的標識值增量, 兩者相加即為下一個標識值 SELECT IDENT_CURRENT('TableName') + IDENT_INCR('TableName'); 參考鏈接:h ...
  • 介紹 有時候我們需要原封不動的複製一張表的表結構來生成一張新表,MYSQL提供了兩種便捷的方法。 例: CREATE TABLE tb_base( id INT NOT NULL PRIMARY KEY, name VARCHAR(10), KEY ix_name (name)) ENGINE='M ...
  • 協同過濾推薦(Collaborative Filtering Recommendation) 基於用戶的協同過濾分為兩個步驟: 1. 找到與目標用戶興趣相似的用戶集合 2. 找到這個集合中用戶喜歡的、並且目標用戶沒有聽說過的物品推薦給目標用戶 計算兩個用戶的興趣相似度: 設 N(u) 為用戶 u 喜 ...
  • Mongodb 簡單入門(個人學習小記) 1、安裝並註冊成服務:(示例) E:\DevTools\mongodb3.2.6\bin>mongod.exe --bind_ip 127.0.0.1 --logpath "E:\mongodbDataBase\accountValueBase\log\lo ...
  • 1,執行完全備份 這是直接備份到g盤的情況 backup database 資料庫名 to disk='g:\database.bak' 這是備份到備份設備的情況,with init是初始化,也就是直接覆蓋 bakup database 資料庫名 to mybackup with init 2,執行 ...
  • 我會用幾篇博客總結一下在Linux中進程之間通信的幾種方法,我會把這個開頭的摘要部分在這個系列的每篇博客中都打出來 進程之間通信的方式 管道 消息隊列 信號 信號量 共用存儲區 套接字(socket) 進程間通信(三)—信號量傳送門:http://www.cnblogs.com/lenomirei/ ...
  • 參考博客“Linux啟動文件、設置環境變數的位置”(http://www.2cto.com/os/201305/208251.html) 在不可取的root許可權的時候可以選擇編輯~/.bashrc文件,加入相應的配置代碼,這樣當登錄時以及每次打開新的shell時,該文件都被讀取。 而在可取的root ...
一周排行
    -Advertisement-
    Play Games
  • 示例項目結構 在 Visual Studio 中創建一個 WinForms 應用程式後,項目結構如下所示: MyWinFormsApp/ │ ├───Properties/ │ └───Settings.settings │ ├───bin/ │ ├───Debug/ │ └───Release/ ...
  • [STAThread] 特性用於需要與 COM 組件交互的應用程式,尤其是依賴單線程模型(如 Windows Forms 應用程式)的組件。在 STA 模式下,線程擁有自己的消息迴圈,這對於處理用戶界面和某些 COM 組件是必要的。 [STAThread] static void Main(stri ...
  • 在WinForm中使用全局異常捕獲處理 在WinForm應用程式中,全局異常捕獲是確保程式穩定性的關鍵。通過在Program類的Main方法中設置全局異常處理,可以有效地捕獲並處理未預見的異常,從而避免程式崩潰。 註冊全局異常事件 [STAThread] static void Main() { / ...
  • 前言 給大家推薦一款開源的 Winform 控制項庫,可以幫助我們開發更加美觀、漂亮的 WinForm 界面。 項目介紹 SunnyUI.NET 是一個基於 .NET Framework 4.0+、.NET 6、.NET 7 和 .NET 8 的 WinForm 開源控制項庫,同時也提供了工具類庫、擴展 ...
  • 說明 該文章是屬於OverallAuth2.0系列文章,每周更新一篇該系列文章(從0到1完成系統開發)。 該系統文章,我會儘量說的非常詳細,做到不管新手、老手都能看懂。 說明:OverallAuth2.0 是一個簡單、易懂、功能強大的許可權+可視化流程管理系統。 有興趣的朋友,請關註我吧(*^▽^*) ...
  • 一、下載安裝 1.下載git 必須先下載並安裝git,再TortoiseGit下載安裝 git安裝參考教程:https://blog.csdn.net/mukes/article/details/115693833 2.TortoiseGit下載與安裝 TortoiseGit,Git客戶端,32/6 ...
  • 前言 在項目開發過程中,理解數據結構和演算法如同掌握蓋房子的秘訣。演算法不僅能幫助我們編寫高效、優質的代碼,還能解決項目中遇到的各種難題。 給大家推薦一個支持C#的開源免費、新手友好的數據結構與演算法入門教程:Hello演算法。 項目介紹 《Hello Algo》是一本開源免費、新手友好的數據結構與演算法入門 ...
  • 1.生成單個Proto.bat內容 @rem Copyright 2016, Google Inc. @rem All rights reserved. @rem @rem Redistribution and use in source and binary forms, with or with ...
  • 一:背景 1. 講故事 前段時間有位朋友找到我,說他的窗體程式在客戶這邊出現了卡死,讓我幫忙看下怎麼回事?dump也生成了,既然有dump了那就上 windbg 分析吧。 二:WinDbg 分析 1. 為什麼會卡死 窗體程式的卡死,入口門檻很低,後續往下分析就不一定了,不管怎麼說先用 !clrsta ...
  • 前言 人工智慧時代,人臉識別技術已成為安全驗證、身份識別和用戶交互的關鍵工具。 給大家推薦一款.NET 開源提供了強大的人臉識別 API,工具不僅易於集成,還具備高效處理能力。 本文將介紹一款如何利用這些API,為我們的項目添加智能識別的亮點。 項目介紹 GitHub 上擁有 1.2k 星標的 C# ...