日志

时间:2017-03-26 15:04:08

标签: cordova cordova-plugins

我使用ReactJS,webpack和只有cordova创建了一个cordova应用程序。该应用程序运行正常,我在我的浏览器,cordova浏览器和Android设备测试它,并运行确定。但在android中我在日志中得到了下一个错误:

    D/SystemWebChromeClient: webpack:///./src/owl.carousel.js?: Line 1507 : Uncaught ReferenceError: jQuery is not defined
I/chromium: [INFO:CONSOLE(1507)] "Uncaught ReferenceError: jQuery is not defined", source: webpack:///./src/owl.carousel.js? (1507)
D/CordovaWebViewImpl: onPageFinished(file:///android_asset/www/index.html)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-device/www/device.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/cordova-plugin-device/www/device.js (1)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-file/www/DirectoryEntry.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/cordova-plugin-file/www/DirectoryEntry.js (1)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-file/www/DirectoryReader.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/cordova-plugin-file/www/DirectoryReader.js (1)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-file/www/Entry.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/cordova-plugin-file/www/Entry.js (1)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-file/www/File.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/cordova-plugin-file/www/File.js (1)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-file/www/FileEntry.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/cordova-plugin-file/www/FileEntry.js (1)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-file/www/FileError.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/cordova-plugin-file/www/FileError.js (1)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-file/www/FileSystem.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/cordova-plugin-file/www/FileSystem.js (1)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-file/www/FileReader.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/cordova-plugin-file/www/FileReader.js (1)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-file/www/FileUploadOptions.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/cordova-plugin-file/www/FileUploadOptions.js (1)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-file/www/FileUploadResult.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/cordova-plugin-file/www/FileUploadResult.js (1)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-file/www/Flags.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/cordova-plugin-file/www/Flags.js (1)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-file/www/FileWriter.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/cordova-plugin-file/www/FileWriter.js (1)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-file/www/LocalFileSystem.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/cordova-plugin-file/www/LocalFileSystem.js (1)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-file/www/Metadata.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/cordova-plugin-file/www/Metadata.js (1)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-file/www/ProgressEvent.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/cordova-plugin-file/www/ProgressEvent.js (1)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-file/www/fileSystems.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/cordova-plugin-file/www/fileSystems.js (1)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-file/www/requestFileSystem.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/cordova-plugin-file/www/requestFileSystem.js (1)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-file/www/resolveLocalFileSystemURI.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/cordova-plugin-file/www/resolveLocalFileSystemURI.js (1)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-file/www/fileSystemPaths.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/cordova-plugin-file/www/fileSystemPaths.js (1)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-file/www/fileSystems-roots.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/cordova-plugin-file/www/fileSystems-roots.js (1)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-geolocation/www/android/geolocation.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/cordova-plugin-geolocation/www/android/geolocation.js (1)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-geolocation/www/PositionError.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/cordova-plugin-geolocation/www/PositionError.js (1)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-splashscreen/www/splashscreen.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/cordova-plugin-splashscreen/www/splashscreen.js (1)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-file/www/android/FileSystem.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/cordova-plugin-file/www/android/FileSystem.js (1)
D/SystemWebChromeClient: file:///android_asset/www/plugins/phonegap-plugin-push/www/push.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/phonegap-plugin-push/www/push.js (1)
D/SystemWebChromeClient: file:///android_asset/www/plugins/cordova-plugin-file/www/browser/isChrome.js: Line 1 : Uncaught TypeError: cordova.define is not a function
I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: cordova.define is not a function", source: file:///android_asset/www/plugins/cordova-plugin-file/www/browser/isChrome.js (1)
D/SystemWebChromeClient: file:///android_asset/www/cordova.js: Line 1469 : Uncaught Error: Module cordova-plugin-device.device does not exist.
I/chromium: [INFO:CONSOLE(1469)] "Uncaught Error: Module cordova-plugin-device.device does not exist.", source: file:///android_asset/www/cordova.js (1469)
V/FA: Inactivity, disconnecting from the service
D/SystemWebChromeClient: file:///android_asset/www/cordova.js: Line 1223 : deviceready has not fired after 5 seconds.
I/chromium: [INFO:CONSOLE(1223)] "deviceready has not fired after 5 seconds.", source: file:///android_asset/www/cordova.js (1223)
D/SystemWebChromeClient: file:///android_asset/www/cordova.js: Line 1216 : Channel not fired: onPluginsReady
I/chromium: [INFO:CONSOLE(1216)] "Channel not fired: onPluginsReady", source: file:///android_asset/www/cordova.js (1216)
D/SystemWebChromeClient: file:///android_asset/www/cordova.js: Line 1216 : Channel not fired: onCordovaReady
I/chromium: [INFO:CONSOLE(1216)] "Channel not fired: onCordovaReady", source: file:///android_asset/www/cordova.js (1216)
W/IInputConnectionWrapper: getExtractedText on inactive InputConnection

如果你检查,错误是关于cordova插件,问题是我在应用程序中没有使用的其中一些插件(因为启动插件)运行正常没有问题。

为什么会出现错误?有时在cordova的浏览器中出现错误,应用程序也不会运行,只能在cordova浏览器中运行。

修改 这是我的index.js。有了这个文件,我就可以打电话了。

import Config from './elements/Config.js';
import Usuario              from './Clases/Usuario.jsx';

var Sesion = require('./elements/Sesion.jsx');
import Routes               from './Routes.jsx';
import Urls                from './elements/Urls.js';
import Rutas                from './elements/Rutas.jsx';
import {Router, Route, Link, DefaultRoute, IndexRoute, browserHistory}        from 'react-router'

window.reload = function (q) {

    if (!q) q = null
    window.location.href = '/index.html?q=' + q;
}

var app = {
    // Application Constructor

    initialize: function () {

        $('#spinner').removeClass('show').addClass('hide');
        var user = Sesion.obt('user');

        if (typeof user == 'object') {
            browserHistory.push(Rutas.urls.dashboard);
        }
        ReactDOM.render(
            <Routes/>,
            document.getElementById('root')
        );

    }

};

if (window.cordova) {
    document.addEventListener('deviceready', function () {
        $("#root").before("cordova");
            app.initialize()

        }, false
    );
} else {
    app.initialize();
}

这就是我在index.html文件中包含的内容

    <div id="root"></div>

<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="cordova_plugins.js"></script>
<script type="text/javascript" src="js/min/libreries.js"></script>
<script type="text/javascript" src="js/dist/app/bundle.js"></script>

bundle.js是运行webpack后所有逻辑的主文件(index.js)。 libreries.js有下一个文件:

  • ReactJS
  • 阵营-DOM
  • 的jQuery

0 个答案:

没有答案