問(wèn)題一
問(wèn)題
[Error: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually. Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to inclde path to valid SDK directory.]
ERROR building one of the platforms: Error: cmd: Command failed with exit code
解決辦法
ANDROID_HOME=D:\apps\Android\sdk
PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
問(wèn)題二
問(wèn)題
Error: Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle
in your path, or install Android Studio
解決辦法
從 https://services.gradle.org/distributions/ 下載最新gradle包并安裝漠嵌。
ANDROID_HOME=/home/kongxx/Android/Sdk
GRADLE_HOME=/apps/gradle-3.2.1
PATH=$PATH:$ANDROID_HOME/tools/:$ANDROID_HOME/platform-tools:$GRADLE_HOME/bin
問(wèn)題三
問(wèn)題
使用 “cordova build android” 打包的時(shí)候報(bào)錯(cuò):Error: Could not find gradle wrapper within Android SDK.
$ cordova build android
CHCP plugin after prepare hook:
config-file set to http://www.tjdr.info/EWT/chcp.json
ANDROID_HOME=/home/kongxx/Android/Sdk
JAVA_HOME=/opt/jdk8
Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.
Looked here: /home/kongxx/Android/Sdk/tools/templates/gradle/wrapper
解決辦法
查看了一下 /home/kongxx/Android/Sdk/tools/templates/gradle/wrapper 目錄彤委,目錄確實(shí)不存在,于是檢查了一下 android-studio 環(huán)境,發(fā)現(xiàn)可以在 plugins/android/lib/templates 目錄下包括上面的內(nèi)容,于是,果斷copy之她肯。
$ cp -rf android-studio/plugins/android/lib/templates /home/kongxx/Android/Sdk/tools/
問(wèn)題四
問(wèn)題
使用Cordova打包時(shí)報(bào)錯(cuò):Error: spawn EACCES
$ cordova build android
CHCP plugin after prepare hook:
config-file set to http://www.tjdr.info/EWT/chcp.json
ANDROID_HOME=/home/kongxx/Android/Sdk
JAVA_HOME=/opt/jdk8
Subproject Path: CordovaLib
Error: spawn EACCES
解決辦法
sudo chmod -Rf 755 ~/Android
問(wèn)題五
問(wèn)題
在 cordova 中使用瀏覽器測(cè)試的時(shí)候佳头,默認(rèn)啟動(dòng)的是 google-chrome 瀏覽器鹰贵,比如:
cordova run browser
解決辦法
可以使用 --target 來(lái)指定想使用的瀏覽器。
cordova run browser --target=opera
cordova run browser --target=firefox