zoukankan      html  css  js  c++  java
  • 在Android Studio 0.5.2中使用ArcGIS Android SDK

    环境

    操作系统:Mac OSX 10.8.5
    Android Studio: 0.5.2
    ArcGIS Android SDK: 10.2.3

    操作步骤

    1. 在Android Studio中新建一个Module,例如:HelloArcGIS
    2. 打开ArcGIS Android SDK所在文件夹,将libs目录下的所有文件拷贝到HelloArcGIS下的libs文件夹
    3. 修改HelloArcGIS的build.gradle文件:
      1. 添加:
        task nativeLibsToJar(type: Zip, description: 'create a jar archive of the native libs') {
          destinationDir file("$buildDir/native-libs")
          baseName 'native-libs'
          extension 'jar'
          from fileTree(dir: 'libs', include: '**/*.so')
          into 'lib/'
        }
        
        tasks.withType(Compile) {
          compileTask -> compileTask.dependsOn(nativeLibsToJar)
        }
      2. 在dependences中添加:
        compile fileTree(dir: "$buildDir/native-libs", include: 'native-libs.jar')
      3. 在android中添加:
        packagingOptions {
          exclude 'META-INF/LGPL2.1'
          exclude 'META-INF/LICENSE'
          exclude 'META-INF/NOTICE'
        }

    最终的build.gradle应该类似于这样

    apply plugin: 'android'
    
    android {
    compileSdkVersion 18
    buildToolsVersion "19.0.3"
    
    defaultConfig {
    minSdkVersion 8
    targetSdkVersion 16
    versionCode 1
    versionName "1.0"
    }
    buildTypes {
    release {
    runProguard false
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
    }
    packagingOptions {
    exclude 'META-INF/LGPL2.1'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/NOTICE'
    }
    }
    
    
    dependencies {
    compile 'com.android.support:appcompat-v7:+'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile fileTree(dir: "$buildDir/native-libs", include: 'native-libs.jar')
    }
    
    task nativeLibsToJar(type: Zip, description: 'create a jar archive of the native libs') {
    destinationDir file("$buildDir/native-libs")
    baseName 'native-libs'
    extension 'jar'
    from fileTree(dir: 'libs', include: '**/*.so')
    into 'lib/'
    }
    
    tasks.withType(Compile) {
    compileTask -> compileTask.dependsOn(nativeLibsToJar)
    }

    参考资料

    1. 解决.so引入的问题,思路是将.so文件打包为jar文件,程序安装后会解压jar,从而使.so文件能被访问

    http://stackoverflow.com/questions/16683775/include-so-library-in-apk-in-android-studio

    2. 解决local path doesn't exist错误
    http://stackoverflow.com/questions/18256177/android-studio-local-path-doesnt-exist

  • 相关阅读:
    PHP数组创建的的两种办法
    Apache配置文件(httpd.conf)的语法检查
    Apache的配置文件,使用了自己的目录,添加了别名的使用
    Apache2.4虚拟主机+别名配置
    margin外边距合并详解
    资源文件res中各种标签的使用
    http://119.145.255.64:10010/repositories/
    一个App的整个流程
    网页快捷键的使用
    oracle 日期字段的处理
  • 原文地址:https://www.cnblogs.com/jubincn/p/3730609.html
Copyright © 2011-2022 走看看