Android 缺少phonegap cordova.js
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20076433/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
phonegap cordova.js is missing
提问by Lukas Lukac
I use my connected phone as an ADB device.
我将连接的手机用作 ADB 设备。
→ phonegap -v 3.1.0-0.15.0
→ phonegap -v 3.1.0-0.15.0
I have almost nothing in my index.html
我的 index.html 中几乎没有任何内容
<script type="text/javascript" src="phonegap.js"></script>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/angular.min.js"></script>
<script type="text/javascript" src="js/main.js"></script>
</body>
When i run
当我跑
→ phonegap local run android
[phonegap] compiling Android...
[phonegap] successfully compiled Android app
[phonegap] trying to install app onto device
[phonegap] successfully installed onto device
I can see my app runing and before did not notice the error in console. Then i tried more complicated things like ngRoute but it did not work. I decided to remove all data to almost empty project as you can see(to be sure something else does not cause this error).
我可以看到我的应用程序正在运行,之前没有注意到控制台中的错误。然后我尝试了更复杂的东西,比如 ngRoute,但它没有用。如您所见,我决定将所有数据删除到几乎为空的项目中(以确保其他原因不会导致此错误)。
Then i checked the console via:
然后我通过以下方式检查了控制台:
adb logcat | grep -i console
And i see:
我看到:
I/Web Console( 3946): Could not find cordova.js script tag. Plugin loading may
fail.:1511
E/Web Console( 3946): Uncaught module cordova/plugin_list already defined:76
I/Web Console( 4329): exception firing pause event from native:1
I/Web Console( 4329): Could not find cordova.js script tag. Plugin loading may fail.:1511
I/Web Console( 4329): Could not find cordova.js script tag. Plugin loading may fail.:1511
I/Web Console( 5006): Could not find cordova.js script tag. Plugin loading may fail.:1511
E/Web Console( 5006): Uncaught module cordova/plugin_list already defined:76
I/Web Console( 5476): Could not find cordova.js script tag. Plugin loading may fail.:1511
I/Web Console( 5949): Could not find cordova.js script tag. Plugin loading may fail.:1511
E/Web Console( 5949): Uncaught module cordova/plugin_list already defined:76
I/Web Console( 6374): Could not find cordova.js script tag. Plugin loading may fail.:1511
E/Web Console( 6374): Uncaught module cordova/plugin_list already defined:76
I/Web Console( 6762): exception firing pause event from native:1
I/Web Console( 6762): Could not find cordova.js script tag. Plugin loading may fail.:1511
I/Web Console( 7141): exception firing pause event from native:1
I/Web Console( 7141): Could not find cordova.js script tag. Plugin loading may fail.:1511
E/Web Console( 7141): Uncaught module cordova/plugin_list already defined:76
I/Web Console( 7267): exception firing pause event from native:1
I/Web Console( 7267): Could not find cordova.js script tag. Plugin loading may fail.:1511
I/Web Console( 7383): exception firing pause event from native:1
I/Web Console( 7383): Could not find cordova.js script tag. Plugin loading may fail.:1511
I/Web Console( 7557): exception firing pause event from native:1
I/Web Console( 7557): Could not find cordova.js script tag. Plugin loading may fail.:1511
I/Web Console( 7697): exception firing pause event from native:1
I/Web Console( 7697): Could not find cordova.js script tag. Plugin loading may fail.:1511
I/Web Console( 7998): exception firing pause event from native:1
I/Web Console( 7998): Could not find cordova.js script tag. Plugin loading may fail.:1511
I/Web Console( 8156): exception firing pause event from native:1
I/Web Console( 8156): Could not find cordova.js script tag. Plugin loading may fail.:1511
E/Web Console( 8156): Uncaught ReferenceError: angular is not defined:10
I/Web Console( 8491): exception firing pause event from native:1
I/Web Console( 8491): Could not find cordova.js script tag. Plugin loading may fail.:1511
E/Web Console( 8491): Uncaught module cordova/plugin_list already defined:76
But it does not makes sence. I have this script tag in my index.html as you can see + this file exists in:
但这没有意义。我的 index.html 中有这个脚本标签,你可以看到 + 这个文件存在于:
platforms/android/assets/www/
I also copied this file into my normal www directory.
我还将这个文件复制到我的普通 www 目录中。
So what's the problem please?
那么请问有什么问题吗?
采纳答案by Lukas Lukac
I have resolved this issue by completely reinstall of everything and setting up enviroment back again but now BY CORDOVA TERMINAL COMMANDS not phonegap.
我已经通过完全重新安装所有内容并再次设置环境解决了这个问题,但现在通过 CORDOVA 终端命令而不是 phonegap。
回答by AntonioHerraizS
Try to remove the line:
尝试删除该行:
<script type="text/javascript" src="phonegap.js"></script>
from your index.html
. If you take a closer look you will see that phonegap.js
and cordova.js
are the same size. Apparently phonegap.js
exists for legacy support reasons, but you should use only cordova.js
.
从你的index.html
. 如果你仔细看,你会看到phonegap.js
和cordova.js
大小相同。显然phonegap.js
出于遗留支持原因而存在,但您应该只使用cordova.js
.
This is what it's actually suggested in the GitHub Issuereferenced in the comments, and it did the trick for me, I stopped getting the Could not find cordova.js script tag
message.
这就是评论中引用的GitHub 问题中实际建议的内容,它对我有用,我不再收到Could not find cordova.js script tag
消息。
回答by AmpT
I replaced the phonegap.js
with cordova.js
and it worked, as referenced here: https://github.com/phonegap/phonegap-cli/issues/134#issuecomment-22035314
我替换了phonegap.js
它cordova.js
并且它起作用了,如下所示:https: //github.com/phonegap/phonegap-cli/issues/134#issuecomment-22035314
Remove from index.html
:
从 中删除index.html
:
<script type="text/javascript" src="phonegap.js"></script>
and add:
并添加:
<script type="text/javascript" src="cordova.js"></script>