zoukankan      html  css  js  c++  java
  • 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
    }
    
    
     
    
    
    
  • 相关阅读:
    React网络请求fetch之get请求
    英语学习
    人物传记
    四月
    启程
    情绪
    办公新址
    孩子大了
    幸福的生日
    hibernate---树状映射
  • 原文地址:https://www.cnblogs.com/jyc226/p/15523025.html
Copyright © 2011-2022 走看看