简体   繁体   English

如何使用Eclipse构建和运行Cordova项目并为Android运行项目

[英]How to Build and run the cordova project with eclipse and run project for android

I have created the project with cordova CLI but i do not know where i need to change and how to run the cordova android project with eclipse for each platform. 我已经使用cordova CLI创建了该项目,但是我不知道我需要在哪里更改以及如何在每个平台上使用eclipse运行cordova android项目。 Thanks for helping 感谢您的帮助

Before run the android project inside your Cordova Project you should know these things. 在Cordova Project中运行android项目之前,您应该了解这些事情。 If you are making any changes in the Cordova Project then first you need to prepare the cordova. 如果要在Cordova项目中进行任何更改,那么首先需要准备Cordova。 use the command cordova prepare 使用命令cordova prepare

Then it changed in your config.xml (for android) automatic as you added or any changes you made. 然后,它会在您添加或进行任何更改时自动在config.xml (适用于Android)中更改。 Do not make any change in your android project which exist inside your Cordova project. 不要在Cordova项目中存在的android项目中进行任何更改。 You can only make change inside the www folder of your Cordova project. 您只能在Cordova项目的www文件夹内进行更改。 And after made changed you need to make cordova prepare every time. 进行更改后,您需要每次准备科尔多瓦。

After prepare the cordova you can run the android project on device or emulator. 准备好科尔多瓦后,您可以在设备或仿真器上运行android项目。 For this you make sure you have made the path of android sdk for platforms-tools and tools in your environment system. 为此,请确保已为环境系统中的platforms-toolstools制作了android sdk路径。 If you not configure this path and add this two path in system environment . 如果未配置此路径,请在系统环境中添加这两个路径。 Now run the android project on device use command cordova run android and run on emulator use this command cordova emulate android . 现在,在设备上使用命令cordova run android android项目cordova run android并在模拟器上运行使用此命令cordova emulate android

And if want to run on eclipse then you should import this android project of your workspace in eclipse. 如果要在eclipse上运行,则应在eclipse中导入工作区的这个android项目。 But if you again made changes in your cordova project then need to delete and again import the android project this switching happened every time so better to run through CLI. 但是,如果您再次在cordova项目中进行了更改,则需要删除并再次导入android项目,这种切换每次都会发生,因此最好通过CLI运行。

I hope you got all things 我希望你有一切

Sunil's answer is good. 苏尼尔的答案很好。 I would like to add logging using Android Debug Bridge ( adb ). 我想使用Android Debug Bridgeadb )添加日志记录
You may want to run: 您可能要运行:

adb logcat

on a seperate shell window for logs after running cordova run android you need when you run into errors .This will produce huge logs, so I would recommend using: 在运行cordova run android后需要在单独的外壳窗口上cordova run android logs ,当您遇到errors时需要使用。这会产生huge日志,因此我建议使用:

adb logcat|grep Cordova

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM