Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error in activity.java for phonegap

I am just configuring my phonegap application and set to run "HelloWorld" Problem. But i cant execute it properly since it always throws me the following error.

Cannot reduce the visibility of the inherited method from DroidGap
The import com.phonegap cannot be resolve

And here is my Code in MainActivity.java

package com.example.mobile;

import org.apache.cordova.DroidGap;

import android.os.Bundle;
import android.view.Menu;
import com.phonegap.*;


public class MainActivity extends DroidGap {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.loadUrl("file:///android_asset/www/index.html");
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }

}

I have created the libs folder and added the cordova-2.2.0.jar , and added to the bulid path. But Still i cant figure out the problem , kindly suggest me a solution to fix it up.

Thanks

like image 974
Hariram Nandagopal Avatar asked Dec 17 '12 07:12

Hariram Nandagopal


2 Answers

Seems like you have 2 problems:

  1. Cannot reduce the visibility of the inherited method from DroidGap - try changing protected void onCreate to public void onCreate.
  2. The import com.phonegap cannot be resolve - try removing the line import com.phonegap.*;
like image 194
Tomer Avatar answered Sep 19 '22 16:09

Tomer


I had the same issue:
change:
protected void onCreate(Bundle savedInstanceState)
to:
public void onCreate(Bundle savedInstanceState)

This worked for me.

like image 2
MarkR Avatar answered Sep 23 '22 16:09

MarkR