1

我按照 Wikitude 中的 POI 示例创建了一个简单的应用程序。当我运行应用程序时,相机视图上没有绘制任何标记。我对示例 POI 应用程序也有同样的问题。onLocationChangedFn我已经在 ' ' 和 ' ' 函数内的 js 文件中放置了一些 JS 警报,createMarkerAtLocation并且警报正确显示(希望这意味着 javascript 函数被正确调用。但标记仍然没有显示在地理位置.

我在 Eclipse 的 logcat 中看到以下内容:

09-21 11:32:50.809: D/dalvikvm(6108): GC_FOR_ALLOC freed 1255K, 29% free 8947K/12551K, paused 18ms, total 19ms

09-21 11:32:50.839: D/dalvikvm(6108): GC_CONCURRENT freed 15K, 24% free 9561K/12551K, paused 12ms+3ms, total 33ms

09-21 11:32:50.849: E/deviceSupported(6108): true

09-21 11:32:50.849: I/ArchitectWebView(6108): ARchitect Build: d4452f2

09-21 11:32:50.919: D/dalvikvm(6108): GC_CONCURRENT freed 561K, 22% free 9826K/12551K, paused 12ms+2ms, total 33ms

09-21 11:32:50.919: D/dalvikvm(6108): WAIT_FOR_CONCURRENT_GC blocked 9ms

09-21 11:32:50.939: D/dalvikvm(6108): GC_FOR_ALLOC freed 733K, 21% free 9920K/12551K, paused 17ms, total 17ms
09-21 11:32:50.969: D/dalvikvm(6108): GC_CONCURRENT freed 608K, 20% free 10147K/12551K, paused 12ms+2ms, total 30ms
09-21 11:32:50.969: D/dalvikvm(6108): WAIT_FOR_CONCURRENT_GC blocked 17ms

09-21 11:32:51.049: E/Web Console(6108): Uncaught ReferenceError: AR is not defined at null:1

09-21 11:32:51.109: I/Adreno200-EGL(6108): <qeglDrvAPI_eglInitialize:299>: EGL 1.4 QUALCOMM build: Nondeterministic AU_msm8625_REFS/TAGS/JB_REL_RB5_QRD_D20130228_CL3285357_release_AU (CL3285357)

09-21 11:32:51.109: I/Adreno200-EGL(6108): Build Date: 03/01/13 Fri

09-21 11:32:51.109: I/Adreno200-EGL(6108): Local Branch:

09-21 11:32:51.109: I/Adreno200-EGL(6108): Remote Branch: m/refs/tags/jb_rel_rb5_qrd_D20130228
09-21 11:32:51.109: I/Adreno200-EGL(6108): Local Patches: NONE

09-21 11:32:51.109: I/Adreno200-EGL(6108): Reconstruct Branch: NOTHING

09-21 11:32:51.179: E/libEGL(6108): called unimplemented OpenGL ES API

09-21 11:32:51.179: W/Adreno200-ES20(6108): <qgl2DrvAPI_glHint:90>: GL_INVALID_ENUM

09-21 11:32:51.179: E/libEGL(6108): called unimplemented OpenGL ES API

09-21 11:32:52.289: D/dalvikvm(6108): GC_FOR_ALLOC freed 1121K, 23% free 9784K/12551K, paused 19ms, total 22ms
09-21 11:32:52.949: E/BufferQueue(6108): [unnamed-6108-1] dequeueBuffer: mMinUndequeuedBuffers=2 exceeded (dequeued=6)
09-21 11:32:52.949: I/Choreographer(6108): Skipped 109 frames!  The application may be doing too much work on its main thread.
09-21 11:32:52.979: E/BufferQueue(6108): [unnamed-6108-1] dequeueBuffer: mMinUndequeuedBuffers=2 exceeded (dequeued=5)
09-21 11:32:55.139: D/dalvikvm(6108): GC_FOR_ALLOC freed 867K, 25% free 9523K/12551K, paused 24ms, total 24ms
09-21 11:32:55.199: D/dalvikvm(6108): GC_CONCURRENT freed 8K, 22% free 10918K/13959K, paused 12ms+5ms, total 47ms

09-21 11:33:08.909: E/Web Console(6108): Uncaught TypeError: Property 'onLocationChanged' of object [object Object] is not a function at null:1

09-21 11:33:08.909: E/Web Console(6108): Uncaught TypeError: Property 'onLocationChanged' of object [object Object] is not a function at null:1

我在上面的日志中看到了两个问题:一个关于 the "unimplemented OpenGL ES API",另一个关于"Uncaught TypeError: Property 'onLocationChanged' "

这些是标记没有出现的原因吗?我该如何解决这些问题并在屏幕上显示标记。请帮忙 ...

这是我在 http://www.wikitude.com/products/wikitude-sdk/samples-tutorials/architect-tutorial-3-geo-ar-poi/上的教程之后创建的 index.html 的源代码

<!DOCTYPE HTML>
<html>

<head>
    <meta name="viewport" content="target-densitydpi=device-dpi, width = 540, user-scalable = 0" />
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

    <script src="architect://architect.js"></script>
    <script type="text/javascript" src="ade.js"></script>
    <script>
        <!-- Javascript function defining a click handler -->
        function messageClicked() {
            // set the message DIV text
            document.getElementById("messageElement").innerHTML = "My text";
        }
    </script>
    <style type="text/css">
/* CSS Style for the message DIV that displays our message */
        .message {
        border-radius: 2em;
        border: solid 1px #6d6d6d;
        background-color: rgba(255,255,255,0.5);
        color: black;
        text-align: center;

        position:absolute;
        width: 50%;
        height: 10%;
        left: 25%;
        top: 45%;
        }
}
</style>
</head>

<body class="custom">

    <div id="messageElement" class="message" onClick="messageClicked();">
        Hello World!
    </div>

    <script>
        AR.context.onLocationChanged = function(lat, lon, alt, acc) {
        // the current location's latitude, longitude, altitude and accuracy
        // are passed in by the ARchitect
        var myGeoLocation = new AR.RelativeLocation(null, 10, 0, 0);
        var myCircle = new AR.Circle(5, {style: {fillColor: '#FFC100'}});
        var myGeoObject = new AR.GeoObject(myGeoLocation, {drawables: {cam: myCircle}});
        //AR.context.onLocationChanged = null;
        // Hide loading message
        //document.getElementById("messageElement").style.display="none";
        }
    </script>

</body>

4

2 回答 2

1

由于Uncaught TypeError执行 JavaScript 代码时出现错误,因此会记录输出。如果您发布代码,我们可能会告诉您出了什么问题。

需要检查的一些事项:

  1. 是否architect.js正确包含
  2. 您是否正确使用了 API(例如忘记添加命名空间AR
  3. 使用ade.jsSDK 附带的在桌面浏览器上进行测试(它提供了更好的调试体验)。

免责声明:我为 Wikitude 工作。

于 2013-09-24T08:07:54.873 回答
1

当我遇到这个问题时,是因为我错过了添加这些功能:

@Override
protected void onResume() {
    super.onResume();
    this.architectView.onResume();
}

@Override
protected void onPause() {
    super.onPause();
    this.architectView.onPause();
}

@Override
protected void onDestroy() {
    super.onDestroy();
    this.architectView.onDestroy();
}


//my own function
private void makeUseOfNewLocation(Location location) {
    try {
        //MAKE SURE YOU CALL THIS
        architectView.setLocation(location.getLatitude(), location.getLongitude(), location.getAltitude(), location.getAccuracy());
        this.architectView.load("poi_1/index.html");
    } catch (IOException e) {
        e.printStackTrace();
    }
}
于 2015-11-10T10:37:57.190 回答