最近刚接手一个地图项目,用的是Arcgis地图,说实话我也是第一次接触这种地图,然后一通百度,下载SDK,搭建环境,最终是因为找不到so文件导致运行失败。
我不清楚是我操作的问题还是SDK(arcgis-android-sdk-v10.2.5)出了问题,死活运行不出来,然后我就放弃搭建了。我看到了ArcGis的文档(https://developers.arcgis.com/android/10-2/guide/use-arcgis-basemaps.htm),按照文档的步骤去搭建,居然运行出来了。建议新手可以尝试一下,先运行出来再说。
第一步:创建一个helloworld工程
第二步:在工程的build.gradle中添加Esri ArcGIS Maven存储库URL,如下所示
第三步:在项目的build.gradle中添加依赖如图(sdk版本不用考虑)
第四步:在项目的build.gradle中的Android{}内添加如图
第五步:在AndroidManifest.xml中添加权限
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<uses-permission android:name="android.permission.INTERNET" />
第六步:
第七步:在MainActivity.xml中添加控件
<com.esri.android.map.MapView
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
mapoptions.MapType="Streets"
mapoptions.center="34.056215, -117.195668"
mapoptions.ZoomLevel="16">
</com.esri.android.map.MapView>
然后点击Build→Mark Project 完成后再运行就Ok了。
百度的搭建环境(加载jar.so文件)我没运行出来,用这种方法我运行出来了,具体为什么我也不清楚,有大神可以指点下。
谢谢!