Removing PhoneGap from the Android Hybrid Web Container

If PhoneGap functionality is not required, you can make a few modifications to remove all references to the PhoneGap library that is linked to the Hybrid Web Container.

Leaving PhoneGap in place does not cause any issues, but does increase overall application size by about 70KB.

  1. Open the UiHybridAppContainer.java file for editing and comment out this line:
    //import com.phonegap.DroidGap;
  2. Change the superclass of UiWorkflowContainer from Droidgap to Activity:
    public class UiWorkflowContainer extends Activity {
  3. Around line 80, change the USE_PHONEGAP variable to false, so the line of code looks like this:
    private static final boolean USE_PHONEGAP = false;
    
  4. At this point, there are 5 errors, which are caused by calling methods that were inherited from the Droidgap class (but do not exist in the Activity class); comment out the 5 lines that cause these errors :
    1. To find these lines, search for "USE_PHONEGAP."
      These lines are all contained in "if ( USE_PHONEGAP )" statements.
    2. Around line 110, comment out:
      // super.init();
                // m_oWebView = this.appView;
    3. Around line 205, comment out:
      // super.setStringProperty( "loadingDialog", m_sProgressText );
                // super.setIntegerProperty( "loadUrlTimeoutValue", 300000 );
                // super.loadUrlWithData( sBaseURL, abData );
  5. Switch to the Java perspective, right-click on the HybridWebContainer project, and choose Properties.
  6. Under Java Build Path, click the Libraries tab.
  7. Remove the PhoneGap library (phonegap<version>.jar-HybridWebContainer/libs).
  8. Delete the phonegap<version>.jar file from the HybridWebContainer\libs folder.