PhoneGap的类未找到文件:///android_asset/www/cordova-2.0.0.js:938 [英] phonegap Class not found at file:///android_asset/www/cordova-2.0.0.js:938
问题描述
我尝试使用这个插件并遵循自述给出的指令。 MD文件。
i try to use this plugin and followed the instruction given in the readme.md file.
1),这里是我的html文件
1)here's 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),这里是我plugins.xml它位于XML文件夹
2) here's my plugins.xml which is located in xml folder
<?xml version="1.0" encoding="utf-8"?>
<plugins>
<plugin name="VideoPlayer" value="com.phonegap.plugins.video.VideoPlayer"/>
</plugins>
3)我也复制VideoPlayer.java到这个文件夹的src \ COM \ PhoneGap的\插件\视频
3) i've also copied the VideoPlayer.java into this folder src\com\phonegap\plugins\video
4)另外,也有人说我还需要添加插件到AndroidManifest.xml文件,所以这是它的一个片段
4) additionally, some said I also need to add the plugin into AndroidManifest.xml file, so this is a snippet 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 on '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:在这里的VideoPlayer.java位于
update1: here's where the VideoPlayer.java is located
我看不出下根文件夹中的VideoPlayer.java,这是否意味着它不是编译?难道这是问题吗?如果是,该如何解决呢?
I don't see the VideoPlayer.java under Gen folder, does that means it's not compiled? Could this be the problem? If yes, how to solve it?
UPDATE2:我查了一下bin文件夹,并有VideoPlayer.class bin下\类\ COM \ PhoneGap的\插件\视频所以VideoPlayer.java实际上是编译
update2: I checked bin folder, and there VideoPlayer.class under bin\classes\com\phonegap\plugins\video so the VideoPlayer.java is actually compiled
推荐答案
这个问题是你的plugins.xml。
the problem is your plugins.xml.
它出现在最近PhoneGap的发布之一,plugins.xml已被删除,你必须添加在RES线/ XML / config.xml文件来代替。
it appears in one of the recent PhoneGap release, the plugins.xml has been removed and you have to add the line in res/xml/config.xml instead.
所以尝试添加标记&LT;插件名称=的VideoPlayer值=com.phonegap.plugins.video.VideoPlayer/&GT;
要RES / XML / config.xml中不plugins.xml
to res/xml/config.xml not to plugins.xml
这篇关于PhoneGap的类未找到文件:///android_asset/www/cordova-2.0.0.js:938的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!