Android上的Cordova是否在Mac上崩溃了?

时间:2016-11-29 00:04:42

标签: android cordova

我试图开始使用Cordova(在Mac Sierra上):https://cordova.apache.org/#getstarted

我已经安装了Android Studio(版本2.2.2),并且我使用的是Android SDK 24.

所以我按照入门指示......

npm install -g cordova
cordova --version

我有Cordova 6.4.0。

cordova create hello
cd hello
cordova platform add android

这应该正常工作,但我收到以下错误:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> You have not accepted the license agreements of the following SDK components:
  [Android SDK Platform 24].
  Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
  Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html

* 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: 28.559 secs
Failed to install 'cordova-plugin-whitelist':Error: /Users/richardeng/hello/platforms/android/gradlew: Command failed with exit code 1
    at ChildProcess.whenDone (/Users/richardeng/hello/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:829:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
Failed to restore plugin "cordova-plugin-whitelist" from config.xml. You might need to try adding it again. Error: Error: /Users/richardeng/hello/platforms/android/gradlew: Command failed with exit code 1

那么Mac是什么?

1 个答案:

答案 0 :(得分:0)

  1. 尝试在Mac OS like is explained here上设置PATH环境变量。
  2. 如果它不起作用尝试更新android studio或只是你的sdkmanager,就像我在my other answer here上解释一样。
  3. 无论如何android studio使自己的android-sdk目录,确保你的cordova项目指向同一目录