脚本宝典收集整理的这篇文章主要介绍了在Android Studio 0.5.2中使用ArcGIS Android SDK,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
环境:
操作系统:Mac OSX 10.8.5
AndROId Studio: 0.5.2
ArcGIS Android SDK: 10.2.3
- 在Android Studio中新建一个Module,例如:HelloArcGIS
- 打开ArcGIS Android SDK所在文件夹,将libs目录下的所有文件拷贝到HelloArcGIS下的libs文件夹
- 修改HelloArcGIS的build.gradle文件:
添加:
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)
}
还是在HelloArcGIS的build.gradle文件,在dependences中添加:
compile fileTree(dir: "$buildDir/native-libs", include: 'native-libs.jar')
在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)
}
参考资料:
-
解决.so引入的问题,思路是将.so文件打包为jar文件,程序安装后会解压jar,从而使.so文件能被访问
http://stackoverflow.com/questions/16683775/include-so-library-in-apk-in-android-studio
解决local path doesn't exist错误
http://stackoverflow.com/questions/18256177/android-studio-local-path-doesnt-exist
以上是脚本宝典为你收集整理的在Android Studio 0.5.2中使用ArcGIS Android SDK全部内容,希望文章能够帮你解决在Android Studio 0.5.2中使用ArcGIS Android SDK所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。