標籤:自動 groov 一個 exce .com 4.0 failed 傳遞 strong
一、搭建Android環境
每一步都要配置環境變數,自行百度即可。
步驟一:安裝NodeJS
可參考http://blog.csdn.net/u010255310/article/details/52205132
步驟二:安裝java的jdk
步驟三:安裝Android的SDK
Android Studio 下載:https://developer.android.com/studio/index.html
點擊安裝,官網有具體安裝步驟。
步驟四:安裝Apache Ant
不需要安裝,只需要把路徑添加到環境變數裡面。
Apache Ant,是一個將軟體編譯、測試、部署等步驟聯絡在一起加以自動化的一個工具,大多用於Java環境中的軟體開發。由Apache軟體基金會所提供。
步驟五:使用npm命令安裝Cordova
cordova提供了一組裝置相關的API,通過這組API,行動裝置 App能夠以JavaScript訪問原生的裝置功能,如網路攝影機、麥克風等。Cordova還提供了一組統一的JavaScript類庫,以及為這些類庫所用的裝置相關的原生後台代碼。
npm install -g cordova
步驟六:安裝Gradle
cordova在6.4.0(cordova-android在6.1.2)之後,會要求安裝Gradle,基於Gradle來編譯、打包android。
Gradle是一個基於JVM的構建工具,它提供了:
- 像Ant一樣,通用靈活的構建工具
- 可以切換的,基於約定的構建架構
- 強大的多工程構建支援
- 基於Apache Ivy的強大的依賴管理
- 支援maven, Ivy倉庫
- 支援傳遞性依賴管理,而不需要遠程倉庫或者是pom.xml和ivy.xml設定檔。
- 對Ant的任務做了很好的整合
- 基於Groovy,build指令碼使用Groovy編寫
- 有廣泛的領域模型支援構
下載:Gradle:https://gradle.org/releases
安裝:http://blog.csdn.net/maosidiaoxian/article/details/40109337
步驟七:設定Android模擬器
通過AVD(Android Virtual Device) manager建立安卓模擬器。
二、將網頁轉換成Android APP
步驟一:建立項目
步驟二:匯入網頁程式
在第一步中,我在 目錄 D:\AndroidStudio\ 下建立了 名為 BuySweat 的Android 項目,將自己寫好的網頁放在 D:\AndroidStudio\BuySweat\www 目錄下,首頁檔案名稱必須為 index.html。
步驟三:建立APP
cordova build
出現了bug
D:\AndroidStudio\BuySweat>cordova buildANDROID_HOME=D:\AndroidStudio\SDKJAVA_HOME=D:\javaSubproject Path: CordovaLibStarting a Gradle Daemon, 1 stopped Daemon could not be reused, use --status for detailsFAILURE: Build failed with an exception.* What went wrong:Unable to start the daemon process.This problem might be caused by incorrect configuration of the daemon.For example, an unrecognized jvm option is used.Please refer to the user guide chapter on the daemon at https://docs.gradle.org/3.3/userguide/gradle_daemon.htmlPlease read the following process output to find out more:-----------------------Error occurred during initialization of VMCould not reserve enough space for 2097152KB object heap* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debugoption to get more log output.Error: cmd: Command failed with exit code 1 Error output:FAILURE: Build failed with an exception.* What went wrong:Unable to start the daemon process.This problem might be caused by incorrect configuration of the daemon.For example, an unrecognized jvm option is used.Please refer to the user guide chapter on the daemon at https://docs.gradle.org/3.3/userguide/gradle_daemon.htmlPlease read the following process output to find out more:-----------------------Error occurred during initialization of VMCould not reserve enough space for 2097152KB object heap* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debugoption to get more log output.
解決方案:
https://stackoverflow.com/questions/20471311/android-studio-unable-to-start-the-daemon-process
最後在platform/android/ant-build/BuySweat-dubug.apk 產生,發送到手機就可以用了。
html5+CSS3+jquery mobile構造簡易WebAPP