导入 org.apache.cordova 无法解析 [英] The import org.apache.cordova cannot be resolved
问题描述
出于某种原因,经过Phonegap的非包容性说明(它甚至没有提到设置ANT,或使用Ant和JDK的头痛)后,这根本不起作用:
For some reason, after going through Phonegap's non-inclusive instructions (it doesn't even mention setting up ANT, or the headaches with Ant and JDK), this doesn't work at all:
package com.HealthTrustSoftware.AndroidTemplate3;
import android.app.Activity;
import android.os.Bundle;
import org.apache.cordova.*;
public class AndroidTemplate3 extends DroidGap
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
}
}
它给出了 5 个错误,引用了无法解析 org.apache.cordova 的事实.我完全确定此时该做什么.请帮忙.这是在尝试让 sdk 工作 3 个小时并最终能够在 eclipse 中打开一个项目之后.按照他们文档中的步骤操作后,除非我能弄清楚这一点,否则我浪费了 3 个小时.
It gives 5 errors referencing the fact that org.apache.cordova can't be resolved. I'm entirely sure what to do at this point. Please help. This is after 3 hours of trying to get the sdk working and finally being able to open a project within eclipse. After following the steps on their documentation, I am left with a wasted 3 hours unless I can figure this out.
推荐答案
我刚刚遇到了同样的问题.按照这里中的内容,我终于成功了.
I just ran into the same problem. Following what was written in here, I finally made it work.
从phonegap github页面下载cordova后,你会发现cordova-2.2.0.jar 和 cordova-2.2.0.js 在 lib/android 文件夹中.运行./create ..."后,将cordova-2.2.0.jar 复制到您的项目libs 文件夹中,将cordova-2.2.0.js 复制到您的www 文件夹中.然后将项目导入eclipse,它应该可以工作.
After you download cordova from phonegap github page, you will find cordova-2.2.0.jar and cordova-2.2.0.js in lib/android folder. After running "./create ...", copy cordova-2.2.0.jar into your projects libs folder and cordova-2.2.0.js into your www folder. Then import the project into eclipse and it should work.
我必须转到项目 -> 属性 -> Android"并选择更新的 SDK(我选择了列表中可用的最新版本),然后还运行项目 -> 清理".
I had to go to "Project -> Properties -> Android" and select a newer SDK (I selected the latest one available on the list) and than run the "Project -> Clean" as well.
这篇关于导入 org.apache.cordova 无法解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!