• ArcGIS Runtime API For Android Kotlin 版入门


    创建项目和去arcgis官网(https://developers.arcgis.com/)注册申请key就省略了。。。

    先配置setting.gradle

    maven {

    url 'https://esri.jfrog.io/artifactory/arcgis'

    }

    build.gradle中

    dependencies中导入implementation 'com.esri.arcgisruntime:arcgis-android:100.12.0'

    android 里 增加

    buildFeatures {

    viewBinding true

    }

    有点时候编译报错可能需要

    packagingOptions{
    exclude 'META-INF/LGPL2.1'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/DEPENDENCIES'
    }
    最外层
    plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'kotlin-android-extensions'
    }
    AndroidManifest.xml增加权限
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <uses-feature
    android:glEsVersion="0x00030000"
    android:required="true" />

    创建地图示例地址https://developers.arcgis.com/android/maps-2d/tutorials/display-a-map/
    build.gradle 代码如下
    plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'kotlin-android-extensions'
    }

    android {
    compileSdk 31
    packagingOptions{
    exclude 'META-INF/LGPL2.1'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/DEPENDENCIES'
    }
    defaultConfig {
    applicationId "com.lantu.app"
    minSdk 23
    targetSdk 31
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
    release {
    minifyEnabled false
    proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
    }
    compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
    jvmTarget = '1.8'
    }
    buildFeatures {
    viewBinding true
    }


    }

    dependencies {

    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'androidx.core:core-ktx:1.3.2'
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
    implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

    implementation 'com.esri.arcgisruntime:arcgis-android:100.12.0'
    }
    project的
    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    buildscript {
    ext.kotlin_version = "1.4.21"
    repositories {
    google()
    mavenCentral()
    }
    dependencies {
    classpath "com.android.tools.build:gradle:7.0.3"
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20"

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    }
    }

    task clean(type: Delete) {
    delete rootProject.buildDir
    }
    
    
     
    
    
    
  • 相关阅读:
    mongodb 修改最大连接数
    js hook eval
    js hook ajax
    js hook cookie
    windows启动redis命令行
    springboot结合redis使用token实现登录注销功能
    springboot实现滑动验证码
    Java读取指定路径文件中的所有资源
    com.alibaba.fastjson.annotation.JSONField依赖
    springboot和session实现验证码功能
  • 原文地址:https://www.cnblogs.com/jyc226/p/15523025.html
Copyright © 2020-2023  润新知