(Android) DroidGap Cordova 1.5 – Error with “Getting Started”

Here is a simple fix to get the new version of DroidGap (1.5) working on Android.

The “Getting Started” section for android simply states an incorrect import. “import com.phonegap.*” If Ecplise is showing errors, change it to “import org.apache.cordova.*

If you’ve used “quick fix” in Eclipse, you’ve probably gotten “import org.apache.cordova.DroidGap;” , which is close, just replace .DroidGap with .* and you should be set.

package com.phonegap.myapp;

//import android.app.Activity; //remove
import android.os.Bundle;
//import com.phonegap.*; //this doesn't work
import org.apache.cordova.*; //this replaces above line

public class MyActivity extends DroidGap {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //setContentView(R.layout.main);
        super.loadUrl("file:///android_asset/www/index.html");
    }
}

Don’t forget to add /lib/cordova-1.5.0.jar to the build path.

Within your AndroidManifest.xml, do a quick find and replace for “com.phonegap” , changing it to “org.apache.cordova”

For me, this replaced two entries.

This entry was posted in Mobile Development and tagged , , , , , . Bookmark the permalink.

3 Responses to (Android) DroidGap Cordova 1.5 – Error with “Getting Started”

Leave a Reply to Ghan Cancel reply

Your email address will not be published. Required fields are marked *