适用于Android的Osmsharp和Mono

时间:2012-05-11 15:00:08

标签: android xamarin.android

我是一名学生,我实际上正在研究如何使用Monmsvelop库Osmsharp。

我使用以下代码进行测试: protected override void OnCreate(Bundle bundle)         {             base.OnCreate(bundle);

        // Set our view from the "main" layout resource
        SetContentView (Resource.Layout.Main);

        // create a router from an osm file.
        Router router = Router.CreateFrom(new FileInfo("demo.osm"));

        // instantiate route end coordinates.
        GeoCoordinate location_from = new GeoCoordinate(51.26565,4.7777);
        GeoCoordinate location_to = new GeoCoordinate(51.2741,4.79795);

        // resolve the end points and link them to the road network.
        ResolvedPoint from = router.Resolve(location_from);
        ResolvedPoint to = router.Resolve(location_to);

        // calculate the route.
        OsmSharpRoute route = router.Calculate(from, to);

        // save the route as a GPX file.
        route.SaveAsGpx(new FileInfo("demo.gpx"));
    }

(此代码是来自Osmsharp库的教程中的代码)

我的问题是当我构建项目时,我有这个错误:

  

System.IO.FileNotFoundException:无法加载程序集'System.Drawing,Version = 4.0.0.0,> Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'。也许它不存在于> Android配置文件的Mono中?

     

文件名:'System.Drawing.dll'

经过一番研究,我添加了对'System.Drawing.dll'和'OpenTK.dll'文件的引用。我还在文件的开头添加了“using”但是我有与以前相同的错误,我不明白为什么。

我想知道是否可以在Mono for Android项目中使用Osmsharp库?

1 个答案:

答案 0 :(得分:0)

我猜OsmSharp需要System.Drawing.dll,这在M​​ono for Android中不可用。