我无法为离子应用程序构建.apk。运行以下命令时遇到以下问题
ionic cordova build android
(node:9166) UnhandledPromiseRejectionWarning: CordovaError: Failed to find 'ANDROID_HOME' environment variable. Try setting it manually.
Detected 'adb' command at /usr/bin but no 'platform-tools' directory found near.
Try reinstall Android SDK or update your PATH to include valid path to SDK/platform-tools directory.
at /home/myname/projects/ionic/myapp/platforms/android/cordova/lib/check_reqs.js:287:27
at _fulfilled (/home/myname/projects/ionic/myapp/platforms/android/cordova/node_modules/q/q.js:854:54)
at /home/myname/projects/ionic/myapp/platforms/android/cordova/node_modules/q/q.js:883:30
at Promise.promise.promiseDispatch (/home/myname/projects/ionic/myapp/platforms/android/cordova/node_modules/q/q.js:816:13)
at /home/myname/projects/ionic/myapp/platforms/android/cordova/node_modules/q/q.js:877:14
at runSingle (/home/myname/projects/ionic/myapp/platforms/android/cordova/node_modules/q/q.js:137:13)
at flush (/home/myname/projects/ionic/myapp/platforms/android/cordova/node_modules/q/q.js:125:13)
at process._tickCallback (internal/process/next_tick.js:61:11)
at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
at startup (internal/bootstrap/node.js:266:19)
(node:9166) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:9166) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
以下是在回显$ ANDROID_HOME和$ PATH时的输出 回声$ ANDROID_HOME
/ Home / Android / Sdk
回显$ PATH
/home/myname/.node/bin:/opt/HP/HP_LoadGenerator/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/ bin:/ usr / games:/ usr / local / games:/ usr / lib / jvm / java-8-oracle / bin:/ usr / lib / jvm / java-8-oracle / db / bin:/ usr / lib / jvm / java-8-oracle / jre / bin:/ Home / Android / Sdk / tools:/ Home / Android / Sdk / platform-tools