SuperMap定位并显示当前位置

0 投票

就跟百度或高德地图一样打开后显示当前位置,我从http://blog.csdn.net/supermapsupport/article/details/50820418#reply
中的评论里下载了demo,里面没有jar包,然后我去官网下载了SuperMap iMobile 8C SP2 for Android_802_8623,拷贝了里面的jar跟so文件,

m_wokspace = new Workspace();
		DatasourceConnectionInfo dsInfo = new DatasourceConnectionInfo();
		dsInfo.setServer(CLOUD_URL);
		dsInfo.setEngineType(EngineType.SuperMapCloud);
		dsInfo.setAlias("SuperMapCloud");
		Datasource ds = m_wokspace.getDatasources().open(dsInfo);

ds获取一直为null,注释掉后运行,就报下面这个错误

06-02 14:56:46.630: E/Surface(15579): Surface::lock failed, already locked
06-02 14:56:46.630: E/SurfaceHolder(15579): Exception locking surface
06-02 14:56:46.630: E/SurfaceHolder(15579): java.lang.IllegalArgumentException
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at android.view.Surface.nativeLockCanvas(Native Method)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at android.view.Surface.lockCanvas(Surface.java:236)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at android.view.SurfaceView$4.internalLockCanvas(SurfaceView.java:807)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at android.view.SurfaceView$4.lockCanvas(SurfaceView.java:768)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at com.supermap.mapping.MapControl1.c(MapControl1.java:295)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at com.supermap.mapping.MapControl1.refreshCallback(MapControl1.java:938)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at com.supermap.mapping.MapControlNative.jni_SetSize(Native Method)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at com.supermap.mapping.MapControl1.a(MapControl1.java:1084)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at com.supermap.mapping.MapControl1.c(MapControl1.java:305)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at com.supermap.mapping.MapControl1$3.surfaceCreated(MapControl1.java:276)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at android.view.SurfaceView.updateWindow(SurfaceView.java:571)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at android.view.SurfaceView.access$000(SurfaceView.java:86)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:175)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:833)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1860)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1004)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5481)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at android.view.Choreographer.doCallbacks(Choreographer.java:562)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at android.view.Choreographer.doFrame(Choreographer.java:532)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at android.os.Handler.handleCallback(Handler.java:730)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at android.os.Handler.dispatchMessage(Handler.java:92)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at android.os.Looper.loop(Looper.java:137)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at android.app.ActivityThread.main(ActivityThread.java:5136)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at java.lang.reflect.Method.invokeNative(Native Method)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at java.lang.reflect.Method.invoke(Method.java:525)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
06-02 14:56:46.630: E/SurfaceHolder(15579): 	at dalvik.system.NativeStart.main(Native Method)

我想问下是什么原因,或者有什么可以运行的demo

6月 2, 2017 分类:  1307次浏览 | 用户: DWHY (2 分)

1个回答

0 投票
6月 2, 2017 用户: Alan 初出茅庐 (54 分)
我下载的就是这个,里面没有jar 然后就是上面的问题了

你是不是没有在grade是设置

  sourceSets {
        main {
            jniLibs.srcDirs = ['libs']
        }
    }
我用的Eclipse。。。。
你好,请问问题解决了吗,我运行这个源码时程序会报错闪退,只要注销掉compassview类的实现程序就可以正常运行,这个是什么问题?
请问这个问题解决了吗?请问你是怎样注销掉compassview类?
...