最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - phonegap cordova.js is missing - Stack Overflow

programmeradmin1浏览0评论

I use my connected phone as an ADB device.

→ phonegap -v 3.1.0-0.15.0

I have almost nothing in my 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).

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:

platforms/android/assets/www/

I also copied this file into my normal www directory.

So what's the problem please?

I use my connected phone as an ADB device.

→ phonegap -v 3.1.0-0.15.0

I have almost nothing in my 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).

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:

platforms/android/assets/www/

I also copied this file into my normal www directory.

So what's the problem please?

Share Improve this question asked Nov 19, 2013 at 16:09 Lukas LukacLukas Lukac 8,34610 gold badges69 silver badges75 bronze badges 8
  • how are you calling index.html from the webkit controls? – C0L.PAN1C Commented Nov 19, 2013 at 16:11
  • Hmm i am not sure what this question mean. – Lukas Lukac Commented Nov 19, 2013 at 16:13
  • in your android code, index.html is called in your WebView control. How does your code for this look? – C0L.PAN1C Commented Nov 19, 2013 at 16:14
  • I still dont know what do you mean. My first day with phonegap. After the successfull compilation of the code(as you can see in question) on the phone the app is launched and i see everything like on desktop browser with styles etc. – Lukas Lukac Commented Nov 19, 2013 at 16:20
  • The bug is tracked here github.com/phonegap/phonegap-cli/issues/134 – J Chris A Commented Nov 19, 2013 at 18:39
 |  Show 3 more comments

3 Answers 3

Reset to default 6

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.

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.

I replaced the phonegap.js with cordova.js and it worked, as referenced here: https://github.com/phonegap/phonegap-cli/issues/134#issuecomment-22035314

Remove from index.html:

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

and add:

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

I have resolved this issue by completely reinstall of everything and setting up enviroment back again but now BY CORDOVA TERMINAL COMMANDS not phonegap.

发布评论

评论列表(0)

  1. 暂无评论