AR World未在Android设备中加载

时间:2017-06-19 12:39:20

标签: cordova

我正面临AR世界没有加载到我的Android设备的问题,因为我使用的是在cordova中开发的wikitude样本,但同样的应用程序可以通过phonegap应用程序运行。但是当为此创建apk文件时,它会给我以下错误

错误是这样的“无法加载架构世界,找不到文件或文件不可读,并且网址形成为:file:/// android_asset / www / world / 01_ImageRecognition / index.html”

请看看这个错误,如果您尽快回复我,我将感激不尽,如果有任何人对此感兴趣请注释并向我提供电子邮件ID,以便我可以向他们发送代码同样的问题。

谢谢

index.js文件

` var app = {

initialize: function() {
    this.bindEvents();
},

bindEvents: function() {
    document.addEventListener("deviceready", this.onDeviceReady, false);
},

onDeviceReady: function() {
    app.wikitudePlugin = cordova.require("com.wikitude.phonegap.WikitudePlugin.WikitudePlugin");

    if ( cordova.platformId == "android" ) {
        app.wikitudePlugin.setBackButtonCallback(app.onBackButton);
    }

    var launchDemoButton = document.getElementById('launch-demo');
    launchDemoButton.onclick = function() {
        app.loadARchitectWorld();
    }
},
loadARchitectWorld: function() {
    app.wikitudePlugin.isDeviceSupported(function() {
        app.wikitudePlugin.loadARchitectWorld(function successFn(loadedURL) {
            }, function errorFn(error) {
                alert('Loading AR web view failed: ' + error);
            },
            cordova.file.dataDirectory + 'www/pgday/index.html', [ '2d_tracking' ], { camera_position: 'back' }
        );
    }, function(errorMessage) {
        alert(errorMessage);
    },
    [ '2d_tracking' ]
    );
}

}; `

的index.html

`

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="format-detection" content="telephone=no" />
        <meta content="width=device-width,initial-scale=1,maximum-scale=5,user-scalable=yes" name="viewport">
        <meta http-equiv="Content-Security-Policy" content="default-src * gap://ready file:; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">
        <link rel="stylesheet" type="text/css" href="css/index.css" />
        <link rel="stylesheet" type="text/css" href="css/buttons.css" />

        <!-- <meta charset="utf-8" /> -->
        <!-- <meta name="format-detection" content="telephone=no" /> -->
        <!-- <meta name="msapplication-tap-highlight" content="no" /> -->
        <!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
        <!-- <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" /> -->
        <!-- <meta http-equiv="content-security-policy" content="default-src * gap:; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'"> -->
        <!-- <meta http-equiv="Content-Security-Policy" content="default-src * gap://ready file:; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'"> -->
        <!-- <link rel="stylesheet" type="text/css" href="css/index.css" /> -->
        <!-- <link rel="stylesheet" type="text/css" href="css/buttons.css" /> -->
        <title>PhoneGap Day Wikitude AR Demo</title>
    </head>
    <body>
        <div class="app">
            <h1>Augmented Reality</h1>
            <p class="subtext">Powered by Wikitude</p>
            <p>Press this button and point your phone to a PhoneGap Day T-Shirt</p>
                <a href="#" id="launch-demo" class="button button-action button-rounded">Fun happy demo time!</a>
        </div>
        <script type="text/javascript" src="cordova.js"></script>
        <script type="text/javascript" src="js/index.js"></script>
        <script type="text/javascript">
            app.initialize();
        </script>
    </body>
</html>

`

0 个答案:

没有答案