操做系統:Mac OSX 10.8.5
Android Studio: 0.5.2
ArcGIS Android SDK: 10.2.3android
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) }
compile fileTree(dir: "$buildDir/native-libs", include: 'native-libs.jar')
packagingOptions { exclude 'META-INF/LGPL2.1' exclude 'META-INF/LICENSE' exclude 'META-INF/NOTICE' }
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文件能被訪問android-studio
http://stackoverflow.com/questions/16683775/include-so-library-in-apk-in-android-studioapp
2. 解決local path doesn't exist錯誤
http://stackoverflow.com/questions/18256177/android-studio-local-path-doesnt-existgradle