总结一:
intall cordova && ionic 参考文档
npm install -g cordova ionic
Create the project cd /home/ubuntu/
ionic start myApp tabs
Configure Platforms
ionic platform add android ionic build android
build 过程中错误解决方法
[Error: Please install Android target: "android-22". Hint: Open the SDK manager by running: /opt/android-sdk/tools/android You will require: 1. "SDK Platform" for android-22 2. "Android SDK Platform-tools (latest) 3. "Android SDK Build-tools" (latest)]
cd到myApp修改下面目录中的target=android-22为target=android-23
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23" />
原因为执行Android SDK Manager 下载tools时最新版本为22
- myApp/platforms/android/project.properties
- myApp/platforms/android/CordovaLib/project.properties
- myApp/platforms/android/AndroidManifest.xml
bulid 完成后apk 生成目录
/home//ubuntu/myApp/platforms/android/build/outputs/apk/android-debug.apk总结二:
问题:
CordovaLib:compileDebugJava/Users/jasontanner/Documents/ion/fip/platforms/android/CordovaLib/src/org/apache/cordova/CordovaResourceApi.java:31: error: package org.apache.http.util does not exist import org.apache.http.util.EncodingUtils; ^ /Users/jasontanner/Documents/ion/fip/platforms/android/CordovaLib/src/org/apache/cordova/CordovaResourceApi.java:430: error: cannot find symbol byte[] data = base64 ? Base64.decode(dataPartAsString, Base64.DEFAULT) : EncodingUtils.getBytes(dataPartAsString, "UTF-8"); ^ symbol: variable EncodingUtils location: class CordovaResourceApi Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. 2 errors FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ‘:CordovaLib:compileDebugJava‘. > Compilation failed; see the compiler error output for details. * 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.663 secs
解决:
ionic platform remove android
ionic platform add android