Notes - wk11 Gradle, NDK, and other

previously: <-use of LBS

  1. Gradle

Gradle 是一個基於Apache Ant和Apache Maven概念的項目自動化構建工具。當前支持語言限於Java, Groovy, Scala.

Coding:
-編譯源代碼
-運行單元測試和集成測試
-執行靜態代碼分析
-創建發佈版本
-部署目標環境
-部署傳遞過程
-執行冒煙測試和自動化測試

shell-command line - gradle setting

gradle-gradle-wrapper.properties下面有一個gradle下載鏈接地址,在我們運行程序的時候如果確實gradle或者gradle對應鏈接下載不了,可能會卡死
可以在settings-preference裏-gardle設置use local gradle distribution, 引用gradle官網鏈接地址

setting.gradle: 包含的模塊, shift+F6 refract
file - new module libraryName
build.gradle: //top level build file where you can add configuration options common to all sub-projects/modules;
jcenter
task clean(type: Delete) {
delete rootProject.buildDir //can also write in Java here
}

Gradle command lines:
gradle: help, version, build, clean, tasks, tasks-all
build-outputs-apk
gradle stop: ctrl + c
rm -rf ~/.gradle
gradle clean && gradle build
gradle assembleDebug/aD
gradle運行支持縮寫,測試,Lint,合併規則
aar自帶manifest

settings-preferences-gradle-offline work
dex 65535
按字母順序排列
Docs:
Gradle User:
https://docs.gradle.org/current/userguide/userguide.html
Google gradle plugin user guide

  1. NDK (native development kit)/JNI (Java native interface Java原生接口)

使用NDK的優勢:1. 保護代碼:APK的JAVA層容易被反編譯,C/C++庫返回難度較大;2. 方便使用現存開源庫; 3. 提高程序的執行效率;4. 便於移植
劣勢:1. 開發麻煩;2. 調試不方便; 3. 難度相對較高
ATTN: 使用NDK大部分情況下是需要將一些已有的C函數庫移植到Android平臺的所選擇的快捷方法,而不是作爲提高代碼效率的手段

How to
1. use AS to creae a native project
2. to build and trace native code
3. use experimental gradle plugin for native project

使用編譯好的”.so”動態庫//copy and quote
使用C/C++源代碼開發

下載NDK,配置 (http://developer.android.com/intl/zh-cn/ndk/index.html
也可以直接project structure 下面NDK直接download

References:
http://blog.csdn.net/zt1990088/article/details/51348287

發佈了38 篇原創文章 · 獲贊 9 · 訪問量 13萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章