简体   繁体   中英

phonegap cordova.js is missing

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?

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>

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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