2014-03-02 43 views
0

我在下面的java代碼中發現錯誤,說配置無法解析?Config無法解析java文件中的phonegap錯誤?

電話GAP版本= PhoneGap的-2.9.1

Cordova2.2.0.jar通過在Eclipse作爲外部庫加入。

Error on the super.loadUrl line: Config cannot be resolved 


package com.cfvabbotsford.bustransit; 


import android.os.Bundle; 
import org.apache.cordova.*; 

public class CFVAbbyBusTrial extends DroidGap 
{ 
    @Override 
    public void onCreate(Bundle savedInstanceState) 
    { 
     super.onCreate(savedInstanceState); 
     // Set by <content src="index.html" /> in config.xml 
     super.loadUrl(Config.getStartUrl()); 

     // super.loadUrl("file:///android_asset/www/index.html"); 

    } 
} 

.Config.xml文件(路徑RES/XML)

<?xml version="1.0" encoding="UTF-8"?> 

<widget xmlns  = "http://www.w3.org/ns/widgets" 
     id  = "io.cordova.helloCordova" 
     version = "2.0.0"> 
    <name>Hello Cordova</name> 

    <description> 
     A sample Apache Cordova application that responds to the deviceready event. 
    </description> 

    <author href="http://cordova.io" email="[email protected]"> 
     Apache Cordova Team 
    </author> 

    <access origin="*"/> 


    <content src="index.html" /> 

    <preference name="loglevel" value="DEBUG" /> 
    <!-- 
     <preference name="splashscreen" value="resourceName" /> 
     <preference name="backgroundColor" value="0xFFF" /> 
     <preference name="loadUrlTimeoutValue" value="20000" /> 
     <preference name="InAppBrowserStorageEnabled" value="true" /> 
     <preference name="disallowOverscroll" value="true" /> 
    --> 

    <feature name="App"> 
     <param name="android-package" value="org.apache.cordova.App"/> 
    </feature> 
    <feature name="Geolocation"> 
     <param name="android-package" value="org.apache.cordova.GeoBroker"/> 
    </feature> 
    <feature name="Device"> 
     <param name="android-package" value="org.apache.cordova.Device"/> 
    </feature> 
    <feature name="Accelerometer"> 
     <param name="android-package" value="org.apache.cordova.AccelListener"/> 
    </feature> 
    <feature name="Compass"> 
     <param name="android-package" value="org.apache.cordova.CompassListener"/> 
    </feature> 
    <feature name="Media"> 
     <param name="android-package" value="org.apache.cordova.AudioHandler"/> 
    </feature> 
    <feature name="Camera"> 
     <param name="android-package" value="org.apache.cordova.CameraLauncher"/> 
    </feature> 
    <feature name="Contacts"> 
     <param name="android-package" value="org.apache.cordova.ContactManager"/> 
    </feature> 
    <feature name="File"> 
     <param name="android-package" value="org.apache.cordova.FileUtils"/> 
    </feature> 
    <feature name="NetworkStatus"> 
     <param name="android-package" value="org.apache.cordova.NetworkManager"/> 
    </feature> 
    <feature name="Notification"> 
     <param name="android-package" value="org.apache.cordova.Notification"/> 
    </feature> 
    <feature name="Storage"> 
     <param name="android-package" value="org.apache.cordova.Storage"/> 
    </feature> 
    <feature name="FileTransfer"> 
     <param name="android-package" value="org.apache.cordova.FileTransfer"/> 
    </feature> 
    <feature name="Capture"> 
     <param name="android-package" value="org.apache.cordova.Capture"/> 
    </feature> 
    <feature name="Battery"> 
     <param name="android-package" value="org.apache.cordova.BatteryListener"/> 
    </feature> 
    <feature name="SplashScreen"> 
     <param name="android-package" value="org.apache.cordova.SplashScreen"/> 
    </feature> 
    <feature name="Echo"> 
     <param name="android-package" value="org.apache.cordova.Echo"/> 
    </feature> 
    <feature name="Globalization"> 
     <param name="android-package" value="org.apache.cordova.Globalization"/> 
    </feature> 
    <feature name="InAppBrowser"> 
     <param name="android-package" value="org.apache.cordova.InAppBrowser"/> 
    </feature> 
    <!-- Deprecated plugins element. Remove in 3.0 --> 
    <plugins> 
    </plugins> 
</widget> 

回答

0

添加cordova2.2.0罐子到lib文件夾中,也把同樣的罐子到WWW文件夾。

放上罐子後,清理你的項目。

它適用於我。欲瞭解更多信息請點擊以下鏈接

The import org.apache.cordova cannot be resolved

+0

仍然沒有工作 –

+0

同樣的問題,不是固定不變的 – Alireza