Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
469 views
in Technique[技术] by (71.8m points)

android - DroidGap cannot be resolved into a type

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);  
  }
}

thanks in advance also i am not getting build path when i right click on lib

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Add this line to the imports

import org.apache.cordova.DroidGap;

EDIT:

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).


EDIT:

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"/>.

Solution: Right-click on the codova-1.x.x.jar -> Build path -> Add to build path.

Please try to follow the steps defined here.


EDIT

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...