您好,我收到一个错误,即 DroidGap 无法解析为一种类型我的代码是
hi i am getting an error that DroidGap cannot be resolved as a type my code is
package com.hello.ponegap;
import android.app.Activity;
import android.os.Bundle;
import com.hello.*;
public class HelloponegapActivity extends DroidGap {
/** Called when the activity is first created. */
@Override public void onCreate(Bundle savedInstanceState) {
super.loadUrl("file:///android_asset/www/index.html");
super.onCreate(savedInstanceState);
}
}
提前致谢当我右键单击 lib 时,我也没有得到构建路径
thanks in advance also i am not getting build path when i right click on lib
将此行添加到导入中
import org.apache.cordova.DroidGap;
<小时>
如果您使用的是 Eclipse,则可以使用组合键 Ctrl + Shift + O
来组织导入.这将删除未使用的导入,并且还将导入所需的包和/或类(如果有多种可能性,例如 android.view.View.OnClickListener
和 android.content.DialogInterface.OnClickListener
,Eclipse 将让您有机会选择要导入的所需类).
If you are using Eclipse, you can use the key combination Ctrl + Shift + O
to organize imports. This removes unused imports, and also will import the needed packages and/or classes (If there are multiple possibilities, e.g. android.view.View.OnClickListener
and android.content.DialogInterface.OnClickListener
, Eclipse will give you the chance to select the desired class to import).
您没有将 cordova jar 添加到构建路径.我在 github repo 上检查了你的 .classpath
文件,它缺少这一行: <classpathentry kind="lib" path="libs/cordova-1.8.1.jar"/>代码>.
You did not add the cordova jar to the build path. I checked your .classpath
file on the github repo, and it lacks this line: <classpathentry kind="lib" path="libs/cordova-1.8.1.jar"/>
.
解决方法:在codova-1.x.x.jar
上右击->构建路径->添加到构建路径.
Solution: Right-click on the codova-1.x.x.jar
-> Build path -> Add to build path.
请尝试按照定义的步骤这里.
Please try to follow the steps defined here.
编辑
执行以下操作: 1. 右键单击项目.2. 单击属性.3. 在左侧,选择 Java Build Path.4. 您会看到四个选项卡:Source
、Projects
、Libraries
、Order and Export
.选择库
.5. 在右侧单击按钮 Add JARs...
.6. 在你的项目中搜索cordova-1.x.x.jar
,并选择它.7. 单击确定
.8. 完成
Do the following: 1. Right-click the project. 2. Click properties. 3. On the left, select Java Build Path. 4. You see four tabs: Source
, Projects
, Libraries
, Order and Export
. Select Libraries
. 5. On the right click the button Add JARs...
. 6. Search for cordova-1.x.x.jar
in your project, and select it. 7. Click OK
. 8. Done
这篇关于DroidGap 无法解析为类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!