Phonegap Class not found in file: ///android_asset/www/cordova-2.0.0.js: 938

I am trying to use this plugin and follow the instructions given in the readme.md file.

1) here is my html file

<!DOCTYPE HTML> <html> <head> <title>TryMakan Video</title> <link rel="stylesheet" href="style.css" /> <script type="text/javascript" charset="utf-8" src="cordova-2.0.0.js"></script> <script type="text/javascript" charset="utf-8" src="video.js"></script> <script type="text/javascript"> function playVideo(){ window.plugins.videoPlayer.play("http://www.trymakan.my/wp-content/uploads/2011/09/NASI-AYAM-BEREMPAH-KAJANG.mp4"); } </script> </head> <body> <a href="#" onClick="playVideo();">play</a> </body></html> 

2) here is my plugins.xml, which is located in the xml folder

 <?xml version="1.0" encoding="utf-8"?> <plugins> <plugin name="VideoPlayer" value="com.phonegap.plugins.video.VideoPlayer"/> </plugins> 

3) I also copied VideoPlayer.java to this src \ com \ phonegap \ plugins \ video folder

4) In addition, some said that I also need to add the plugin to the AndroidManifest.xml file, so this is a fragment of it

 <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".MainActivity" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/title_activity_main" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <action android:name="com.phonegap.plugins.video.VideoPlayer"/> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> 

but still, when I click play, log cat will return this error

 08-08 04:54:15.823: I/Web Console(309): Error: Status=2 Message=Class not found at file:///android_asset/www/cordova-2.0.0.js:938 

update1: here where VideoPlayer.java is located

here

I do not see VideoPlayer.java in the Gen folder, does this mean that it is not compiled? Could this be a problem? If so, how to solve it?

update2: I checked the bin folder and there VideoPlayer.class in bin \ classes \ com \ phonegap \ plugins \ video, so VideoPlayer.java is actually compiled

+8
android cordova
source share
3 answers

The problem is your plugins.xml file.

it appears in one of the latest releases of PhoneGap, the plugins.xml file is deleted, and instead you should add a line to res / xml / config.xml.

try adding the tag <plugin name="VideoPlayer" value="com.phonegap.plugins.video.VideoPlayer"/>

for res / xml / config.xml not for plugins.xml

+10
source share

If the error displayed in the log is

The class was not found in the file: ///android_asset/www/cordova-2.0.0.js: 938

The best way is to check the class that causes the error. For those who still get this error message, try the following trick.

  • Open the cordova-2.0.0.js editor in the editor.
  • Replace code on line 938, i.e.

    console.log ("Error: Status =" + v.status + "Message =" + v.message);

    from

    console.log ("Error: Status =" + v.status + "Message =" + v.message + "service =" + service + "action =" + action);

  • Run the application again and check the console for the error described above. You can see the plugin that causes an error in the service = XYZ , where XYZ is the name of the plugin.

  • Check if the section for the XYZ plugin is in the config.xml file.
  • Add the XYZ plugin if it is not found.
+6
source share

I had this error due to a missing plugin. I added

 <plugin name="Device" value="org.apache.cordova.Device"/> 

to the config.xml file and he fixed it.

+2
source share

All Articles