I'm going to create a phonegap project and would like to create a small welcome application to make sure that the phonegap application is working fine. To do this, I print out information about some devices. Here is my JavaScript code:
function onDeviceReady(){
document.getElementById("name").innerHTML = device.name;
document.getElementById("phonegap").innerHTML = device.phonegap;
document.getElementById("platform").innerHTML = device.platform;
document.getElementById("version").innerHTML = device.version;
document.getElementById("uuid").innerHTML = device.uuid;
}
function init(){
document.addEventListener("deviceready", onDeviceReady, false);
}
As soon as I run this code, I get the following error message:
Unable to open resource url: file: ///android_asset/www/cordova_plugins.json
I tried to comment out the lines of device.name and device.phonegap, but this could not be fixed.
Any ideas to fix this? I am using Cordova 2.9.0 and have included both the config.xml file and my full error log.
config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns = "..."
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="..." email="dev@cordova.apache.org">
Apache Cordova Team
</author>
<access origin="*"/>
<content src="index.html" />
<preference name="loglevel" value="DEBUG" />
<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>
<plugins>
</plugins>
</widget>
CatLog:
D/CordovaWebView(8703): CordovaWebView is running on device made by: LGE
D/JsMessageQueue(8703): Set native->JS mode to 2
D/CordovaActivity(8703): CordovaActivity.init()
D/CordovaWebView(8703): >>> loadUrl(file:///android_asset/www/index.html)
D/PluginManager(8703): init()
D/CordovaWebView(8703): >>> loadUrlNow()
D/Config(8703): Unlimited access to network resources
I/CordovaLog(8703): Found start page location: index.html
I/CordovaLog(8703): Changing log level to DEBUG(3)
D/CordovaActivity(8703): Resuming the App
D/CordovaActivity(8703): CB-3064: The errorUrl is null
D/CordovaActivity(8703): onMessage(onPageStarted,file:///android_asset/www/index.html)
I/ActivityManager(770): Displayed sample/.HelloPhonegap: +254ms
E/AndroidProtocolHandler(8703): Unable to open asset URL: file:///android_asset/www/cordova_plugins.json
D/Cordova(8703): onPageFinished(file:///android_asset/www/index.html)
D/CordovaActivity(8703): onMessage(onPageFinished,file:///android_asset/www/index.html)
E/AndroidProtocolHandler(8703): Unable to open asset URL: file:///android_asset/www/cordova_plugins.js
EDIT (workaround)
cordova_plugins.json . , , , device.name device.phonegap( undefined).
( 3.x)
3.x . , . , Cordova 3.x( 3.1, 3.4)