我在Wikitude中按照POI示例创建了一个简单的应用程序。当我运行应用程序时,摄像机视图上没有绘制标记。我也有样本POI应用程序的相同问题。我在“onLocationChangedFn
”和“createMarkerAtLocation
”函数中的js文件中放了一些JS警报,并且警报正确显示(希望这意味着正确调用了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
我在上面的日志中看到两个问题:一个关于"unimplemented OpenGL ES API"
,另一个关于"Uncaught TypeError: Property 'onLocationChanged' "
那些标记没有出现的原因是什么?如何修复这些并在屏幕上显示标记。请帮忙......
以下是我在本教程后创建的index.html的源代码 http://www.wikitude.com/products/wikitude-sdk/samples-tutorials/architect-tutorial-3-geo-ar-poi/
<!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>
答案 0 :(得分:1)
由于执行JavaScript代码时出错,会记录Uncaught TypeError
输出。如果您发布代码,我们可能会告诉您错误。
要检查的一些事项:
architect.js
AR
)ade.js
在桌面浏览器上进行测试(它提供了更好的调试体验)。免责声明:我为Wikitude工作。
答案 1 :(得分:1)
当我遇到这个问题时,那是因为我错过了添加这些功能:
public class SyncAdapter extends AbstractThreadedSyncAdapter {
private final AccountManager mAccountManager;
public SyncAdapter(Context context, boolean autoInitialize) {
super(context, autoInitialize);
mAccountManager = AccountManager.get(context);
}
@Override
public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) {
Log.d("udinic", "onPerformSync for account[" + account.name + "]");
try {
// TODO Updating local tv shows
} catch (Exception e) {
e.printStackTrace();
}
}
}