2012-12-17 24 views
6

我只是配置我的phonegap應用程序,並設置爲運行「HelloWorld」問題。但我無法正確執行它,因爲它總是拋出以下錯誤。錯誤的activity.java手機版

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文件夾,並添加了科爾多瓦-2.2.0.jar代碼,並將其添加到bulid路徑。但我仍然無法找出問題,請提出解決問題的方法。

感謝

回答

14

好像你有2個問題:

  1. Cannot reduce the visibility of the inherited method from DroidGap - 嘗試改變protected void onCreatepublic void onCreate
  2. The import com.phonegap cannot be resolve - 嘗試刪除線import com.phonegap.*;
+0

令人驚歎的男人你的偉大,真的保存我的日子 – Harry

+1

很高興我可以幫助:) – Tomer

+0

DroidGap無法解決。請幫我解決這個問題。請 –

2

我有同樣的問題:
變化:
protected void onCreate(Bundle savedInstanceState)
到:
public void onCreate(Bundle savedInstanceState)

這爲我工作。