我只是在配置我的phonegap应用程序并设置为运行“HelloWorld”问题。但是我无法正确执行它,因为它总是会引发以下错误。

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

这是我在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;
    }

}

我已经创建了libs文件夹,并添加了cordova-2.2.0.jar,并添加至bulid路径。但是我仍然无法解决问题,请向我提出解决问题的解决方案。

谢谢

最佳答案

似乎您有2个问题:

  • Cannot reduce the visibility of the inherited method from DroidGap-尝试将protected void onCreate更改为public void onCreate
  • The import com.phonegap cannot be resolve-尝试删除import com.phonegap.*;
  • 关于java - phonegap的activity.java错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13909904/

    10-14 13:31
    查看更多