ArcGIS Runtime for Android (100.3.0 --- 100.5.0)配置

注意:华为手机需要添加如下配置(build.gradle(Module.app)),否则闪退因为华为不兼容arcgis,主要原因是so文件不兼容,对so文件有兴趣可以看看这篇文章
https://www.jianshu.com/p/cb05698a1968

在线配置:

 
  1. android {

  2. compileSdkVersion 29

  3. buildToolsVersion "29.0.3"

  4. defaultConfig {

  5. applicationId "com.chy.esrimap"

  6. minSdkVersion 19

  7. targetSdkVersion 29

  8. versionCode 1

  9. versionName "1.0"

  10. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

  11. ndk{abiFilters"armeabi","armeabi-v7a"}

  12. }

*建议使用Gradle进行安装配置(在线配置)*

1.在Project的build.gradle文件中进行以下配置:

 
  1. allprojects {

  2. repositories {

  3. google()

  4. jcenter()

  5.  
  6. // Add the following ArcGIS repository

  7. maven {

  8. url 'https://esri.bintray.com/arcgis'

  9. }

  10. }

  11. }

 

2.在module的build.gradle中添加依赖:

 
  1. // Add ArcGIS Runtime SDK for Android dependency

  2. implementation 'com.esri.arcgisruntime:arcgis-android:100.3.0'

3.

AndroidManifest.xml文件:

 
  1. <uses-permission android:name="android.permission.INTERNET" />

  2. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

  3. <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

  4.  
  5. <uses-feature

  6. android:glEsVersion="0x00020000"

  7. android:required="true"/>

离线配置:

1.下载ArcGIS Runtime SDK for Android, 前往https://developers.arcgis.com/downloads/apis-and-sdks?product=android下载(需要先注册,登录后才能下载)

2.配置本地环境
解压资源包后观察文件目录,我们需要的资源文件在libs文件夹下

进入libs目录,文件与文件夹分为三类,aar文件夹,系统依赖包文件夹和jar包。这里不是每个文件和文件夹都用得到,只需要aar文件夹下的文件和gson-2.8.5.jar文件。

aar文件夹下的文件都要加入到项目中,aar文件相当于另一个完整的android项目,作为依赖包的形式可引入到其他项目中,作用于jar包类似,但在jar包的基础上还包含了项目的其他必要文件,比如各种资源文件(drawable和layout等)。
 

 

在build.gradle(Module:app)文件中配置

 
  1. apply plugin: 'com.android.application'

  2.  
  3. android {

  4. compileSdkVersion 29

  5. buildToolsVersion "29.0.3"

  6. defaultConfig {

  7. applicationId "com.chy.arcgisforpipeline"

  8. minSdkVersion 19

  9. targetSdkVersion 29

  10. versionCode 1

  11. versionName "1.0"

  12. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

  13. }

  14. buildTypes {

  15. release {

  16. minifyEnabled false

  17. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

  18. }

  19. }

 
  1. packagingOptions {

  2. exclude 'META-INF/LGPL2.1'

  3. exclude 'META-INF/LICENSE'

  4. exclude 'META-INF/NOTICE'

  5. }

  6.  
  7. repositories {

  8. flatDir{

  9. dirs 'libs'

  10. }

  11. }

 
  1. }

  2.  
  3. dependencies {

  4. implementation fileTree(dir: 'libs', include: ['*.jar'])

  5. implementation 'androidx.appcompat:appcompat:1.1.0'

  6. implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

  7. testImplementation 'junit:junit:4.12'

  8. androidTestImplementation 'androidx.test.ext:junit:1.1.1'

  9. androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

  10. implementation(name:'arcgis-android-100.3.0', ext:'aar')

  11. }

因为加载网络地图需要配置网络权限,因此需要在权限清单中加入网络权限。

<uses-permission android:name="android.permission.INTERNET"></uses-permission
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值