科尔多瓦为Android:一边听着Android的目标时出错 [英] Cordova for android: An error occurred while listening android targets

查看:245
本文介绍了科尔多瓦为Android:一边听着Android的目标时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看过所有的同样的问题的问题,我已经尝试了一切,但没有什么工作对我来说,当我尝试添加Android平台的科尔多瓦。

I have read all the questions for the same problems and I have tried everything but nothing is working for me when I try to add android platform for cordova.

c:\Apps\fapp>cordova platform add android
Creating android project...

C:\Users\Andrej\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.js:126
                    throw e;
                          ^
Error: An error occurred while listing Android targets
    at C:\Users\Andrej\.cordova\lib\android\cordova\3.4.0\bin\lib\check_reqs.js:
87:29
    at _rejected (C:\Users\Andrej\.cordova\lib\android\cordova\3.4.0\bin\node_mo
dules\q\q.js:808:24)
    at C:\Users\Andrej\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.j
s:834:30
    at Promise.when (C:\Users\Andrej\.cordova\lib\android\cordova\3.4.0\bin\node
_modules\q\q.js:1079:31)
    at Promise.promise.promiseDispatch (C:\Users\Andrej\.cordova\lib\android\cor
dova\3.4.0\bin\node_modules\q\q.js:752:41)
    at C:\Users\Andrej\.cordova\lib\android\cordova\3.4.0\bin\node_modules\q\q.j
s:574:44
    at flush (C:\Users\Andrej\.cordova\lib\android\cordova\3.4.0\bin\node_module
s\q\q.js:108:17)
    at process._tickCallback (node.js:415:13)
Error: cmd: Command failed with exit code 8
    at ChildProcess.whenDone (C:\Users\Andrej\AppData\Roaming\npm\node_modules\c
ordova\src\superspawn.js:112:23)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:743:16)
    at Process.ChildProcess._handle.onexit (child_process.js:810:5)

  • 在项目中使用创建的科尔多瓦创造FAPP com.fapp FAPP
  • 的系统是Windows 8
  • ANT,JAVA(JDK 1.7.0_51和JRE7),Android的软件开发工具包是从(17-19.0.3)安装和Android的API(17-19)
  • 在所有的环境变量JAVA,Android和ANT设置以及路径斌对所有的人都到PATH变量中。
    • Project is created using cordova create fapp com.fapp Fapp
    • System is windows 8
    • ANT, JAVA (JDK 1.7.0_51 and JRE7), Android SDKs are installed from (17-19.0.3) and Android APIs (17-19)
    • All environment variables for JAVA, ANDROID and ANT are set as well as path to bin for all of them into Path variable.
    • 我真的什么都试过了,但不断抛出这个问题。

      I really tried everything but keeps throwing this problem.

      编辑:

      • 在这里的回答并没有帮助: <一href="http://stackoverflow.com/questions/21699585/cordova-ubuntu-an-error-occurred-while-listing-android-targets">cordova Ubuntu的:同时列出Android的目标
      • 时发生错误
      • 权限被设置为Everyone完全控制和同样的问题
      • Answer here did not help: cordova ubuntu: An error occurred while listing Android targets
      • Permissions are set to Everyone full control and same issue

      最终的解决方案

      • 最后我重新安装了JDK和Android SDK,现在一切正常,即使它仍然是谜我。

      推荐答案

      我有同样的问题,并通过设置以下的环境变量解决了

      I had the same issue and solved it by setting the following environment variables:

      • %JAVA_HOME%指向您的Java安装的根目录(不是bin目录)。在我的电脑上,它是: C:\ Program Files文件\的Java \ jdk1.8.0 。为了验证它是正确的配置,打开一个新的终端,然后键入的javac 。它应该运行java编译器,不应该抱怨它不知道的命令。请注意,环境变量打开一个新的终端(至少在Windows上)时,所以每次你改变一些东西时,你必须打开一个新的终端只设置。

      • %JAVA_HOME% points to the root of your java installation (not the bin directory). In my computer it is: C:\Program Files\Java\jdk1.8.0. To test that it is configured correctly, open a new terminal and type javac. It should run the java compiler and shouldn't complain that it doesn't know the command. Please note that environment variables are only set when opening a new terminal (at least on windows) so every time you change something you have to open a new terminal.

      %ANT_HOME%指向您已经安装的Apache Ant的根。在我的电脑上,它是: C:\用户\用户\ Apache的ANT-1.9.3 。通过运行蚂蚁命令测试一下。它不应该抱怨蚂蚁命令是未知的,你的机器。记住设置路径后,打开一个新的终端,然后尝试运行ant。

      %ANT_HOME% point to the root of where you've installed Apache ant. In my computer it is: C:\Users\User\apache-ant-1.9.3. Test it by running the ant command. It shouldn't complain that the ant command is unknown to your machine. Remember to open a new terminal after setting the path and then try running ant.

      %ANDROID_HOME%指向您已经安装了Android SDK中。例如: C:\用户\用户\机器人\ SDK 。然后尝试键入模拟器,以确保它被正确安装。

      %ANDROID_HOME% points to where you have installed your android SDK. For example: C:\Users\User\android\sdk. Then try typing emulator to make sure it is installed correctly.

      在所有这些变量的设置,你可以用它们在 PATH 环境变量:

      When all of these variables are set, you can use them in the PATH environment variable :

      %PATH%包含以下内容:%ANT_HOME%\ BIN;%ANDROID_HOME%\工具;%ANDROID_HOME%\平台工具; %JAVA_HOME%\ BIN

      在Windows 8中,你可以通过右击开始按钮,选择系统,然后的高级系统设置的,点击环境变量按钮配置路径和变量。记住要确定上述路径上的环境变量。我定义中的所有的用户变量的,它工作得很好。

      On windows 8 you can configure path and variables by right clicking on the start button, choosing system, and then advanced system settings and clicking on environment variables button. Remember to define the above environment variables above PATH. I defined everything in the user variables and it works just fine.

      这篇关于科尔多瓦为Android:一边听着Android的目标时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆