简体   繁体   English

phonegap cordova.js不见了

[英]phonegap cordova.js is missing

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. 然后我尝试了更复杂的东西,如ngRoute,但它没有用。 I decided to remove all data to almost empty project as you can see(to be sure something else does not cause this error). 我决定将所有数据删除到几乎为空的项目,如您所见(确保其他内容不会导致此错误)。

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? 请问有什么问题?

Try to remove the line: 尝试删除该行:

<script type="text/javascript" src="phonegap.js"></script>

from your index.html . 来自你的index.html If you take a closer look you will see that phonegap.js and cordova.js are the same size. 如果你仔细看看,你会发现phonegap.jscordova.js的大小相同。 Apparently phonegap.js exists for legacy support reasons, but you should use only cordova.js . 显然,出于遗留支持的原因,存在phonegap.js ,但您应该只使用cordova.js

This is what it's actually suggested in the GitHub Issue referenced 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消息。

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.jscordova.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>

我通过完全重新安装所有内容并重新设置环境来解决这个问题,但现在BY CORDOVA TERMINAL COMMANDS不是phonegap。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM