Error: The method loadUrl(String) is undefined for the type Activity

If you are trying to build an Android Application using PhoneGap/Apache Cordova, you may get this error.
The error may occur in two conditions :
  • You have not included the PhoneGap.jar / cordova-2.0.0.jar to your build path. To do so, first copy the jar file to /libs directory under project directory.  Then right click on project directory in eclipse, click "Build Path -> Configure Build Path". Under Java Build Path Select Libraries tab and click on "Add JARs" button. Choose the copied jar file from "lib" directory.  
  • You have not extended your activity from DroidGap. Check the java source file of your project the main activity should be derived from DroidGap as below:
    public class MainActivity extends DroidGap.
This should resolve the error.

1 comment:

  1. The method setIntegerProperty(String, int) is undefined for the type CordovaActivity

    how to resolve can anyone help me?

    ReplyDelete

Golang: Http POST Request with JSON Body example

Go standard library comes with "net/http" package which has excellent support for HTTP Client and Server.   In order to post JSON ...