eclipse Cordova 蚂蚁罐不可用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20659853/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cordova ant jar not available
提问by nimbusgb
Cordova 3.3.0 installed from fresh and PATH fixed with visibility to tools etc.
从新安装的 Cordova 3.3.0 和 PATH 修复了工具等的可见性。
Build a new bare application Add android platform
构建新的裸应用 添加android平台
now it starts to go awry -
现在开始出错了——
Following instructions to import to Android Development Tools ( Eclipse ) I get TWO projects created HelloWorld and HelloWorld-CordovaLib
按照导入到 Android 开发工具 (Eclipse) 的说明,我创建了两个项目 HelloWorld 和 HelloWorld-CordovaLib
HelloWorld has errors as it can't see/does not have the the cordova.jar file ( assuming this from past experience )
HelloWorld 有错误,因为它看不到/没有 cordova.jar 文件(根据过去的经验假设)
HelloWorld-CordovaLibs is whats missing from the HelloWorld project all the source to Cordova
HelloWorld-CordovaLibs 是 HelloWorld 项目中缺少的所有 Cordova 源
Assuming that I need the jar file I dig around and try running ant jar from within the android part of my project
假设我需要我挖掘的 jar 文件并尝试从我的项目的 android 部分运行 ant jar
Running ant jar fails -
运行 ant jar 失败 -
Target "jar" does no exist in the project "HelloWorld"
项目“HelloWorld”中不存在目标“jar”
which is an ant error telling me it doesn't know how to build target jar.
这是一个蚂蚁错误,告诉我它不知道如何构建目标 jar。
look at build.xml in the android directory confirms this - no section on "jar" A bit more digging on the net and the Apache Cordova git repository seems to intimate that I should have another file build.xml inside a directory 'framework' with the jar target defined.
查看 android 目录中的 build.xml 证实了这一点 - 没有关于“jar”的部分在网上进行了更多的挖掘,Apache Cordova git 存储库似乎暗示我应该在目录“framework”中使用另一个文件 build.xml定义的 jar 目标。
Ahhhhh - no framework directory anywhere.
Ahhhhh - 任何地方都没有框架目录。
Can anyone work out where this is all going wrong before I tear any more hair out?
在我撕掉更多头发之前,有人能弄清楚这一切是哪里出了问题吗?
采纳答案by MBillau
I followed this guide to create a Cordova 3.3.0 project, import it into Eclipse, and successfully run it on a device from Eclispe: http://cordova.apache.org/docs/en/3.3.0/guide_platforms_android_index.md.html#Android%20Platform%20Guide
我按照本指南创建了一个 Cordova 3.3.0 项目,将其导入 Eclipse,并在 Eclispe 的设备上成功运行:http: //cordova.apache.org/docs/en/3.3.0/guide_platforms_android_index.md。 html#Android%20Platform%20Guide
You are right that it imports "HelloWorld" and "HelloWorld-CordovaLibs". This is because of https://issues.apache.org/jira/browse/CB-5232, which makes Android now use the CordovaLib instead of the .jar for a variety of reasons (see the bug report.) You should import both projects into Eclipse (I'll change this in the documentation).
你是对的,它导入了“HelloWorld”和“HelloWorld-CordovaLibs”。这是因为https://issues.apache.org/jira/browse/CB-5232,这使得 Android 现在出于各种原因使用 CordovaLib 而不是 .jar(请参阅错误报告。)您应该同时导入项目到 Eclipse(我将在文档中更改它)。
If you follow that guide you should be fine. You don't have to build a .jar anymore.
如果您遵循该指南,则应该没问题。您不必再构建 .jar 了。
回答by hosumayok
steps
脚步
1- after create the project i import both "hello" and "hello-cordovaLib"
1- 创建项目后,我同时导入“hello”和“hello-cordovaLib”
2- i remove the reference to "hello-cordovaLib" from "hello"
2-我从“hello”中删除了对“hello-cordovaLib”的引用
3- build the "hello-cordovaLib"
3- 构建“hello-cordovaLib”
4- restore the reference to "hello-cordovaLib" from "hello"
4- 从“hello”恢复对“hello-cordovaLib”的引用
5- clean "hello" and run
5-清理“你好”并运行
回答by nimbusgb
In short .... The ide ( either eclipse or ADT ) needed the initial build of the sub project to allow the HelloWorld project to 'see' the HelloWorld-cordovaLibs project.
简而言之.... ide(eclipse 或 ADT)需要子项目的初始构建,以允许 HelloWorld 项目“看到”HelloWorld-cordovaLibs 项目。
回答by Swapnil Mhaske
What solved my problem on HelloWorld project in my ADT is :
在我的 ADT 中解决我的 HelloWorld 项目问题的是:
- I cleaned both the HelloWorld and the HelloWorld-cordovaLib.
- Right clicked on HelloWorld-cordovaLib ->properties->Android and verified it the isLibrary is checked.
- I right clicked on HelloWorld proj -> Properties ->Android -> The "is Library part" had Cordova with red check on it then I clicked on "Add" button and again added Cordova to the project which came with "green check" and then removed the red checked cordova.
- 我清理了 HelloWorld 和 HelloWorld-cordovaLib。
- 右键单击 HelloWorld-cordovaLib ->properties->Android 并验证它是否检查了 isLibrary。
- 我右键单击 HelloWorld proj -> 属性 -> Android -> “是库部分”的 Cordova 带有红色检查,然后我单击“添加”按钮并再次将 Cordova 添加到带有“绿色检查”的项目中,然后然后取下红色格子科尔多瓦。
Cleaned the projects and now its working fine.
清理了项目,现在工作正常。