[英]Add pre-built .so files in project using Android Gradle plugin 0.7.3
Well after a long time the support to add pre-built .so files in an Android project has been added in Android Gradle plugin 0.7.3. 很久以后,在Android Gradle插件0.7.3中添加了在Android项目中添加预先构建的.so文件的支持。 But unlike me a lot of people are still using the hack/workaround to add pre-built .so files, ie zip the files using a certain hierarchy and then re-name into a .jar.
但与我不同的是,很多人仍在使用hack / workaround添加预先构建的.so文件,即使用特定层次结构压缩文件,然后重命名为.jar。 Below is a step by step guide to how to properly add .so files.
以下是如何正确添加.so文件的分步指南。
So how you can add the pre-built .so files ? 那么如何添加预先构建的.so文件呢?
1) Upgrade your android studio to 0.4.0 1)将你的android工作室升级到0.4.0
2) Replace "distributionUrl=" in gradle-wrapper.properties with "distributionUrl=http://services.gradle.org/distributions/gradle-1.9-all.zip" 2)将gradle-wrapper.properties中的“distributionUrl =”替换为“distributionUrl = http://services.gradle.org/distributions/gradle-1.9-all.zip”
3) Add/Replace your 'buildscript' section build.gradle with: 3)添加/替换你的'buildscript'部分build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.3'
}
}
4) 4)
5) Add the following in your build.gradle: 5)在build.gradle中添加以下内容:
android {
compileSdkVersion 18
buildToolsVersion "18.1.0"
defaultConfig {
minSdkVersion 10
targetSdkVersion 18
}
productFlavors {
x86 {
ndk {
abiFilter "x86"
}
}
arm {
ndk {
abiFilters "armeabi-v7a", "armeabi"
}
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/notice.txt'
}
}
6) Build your project. 6)建立你的项目。
I finally got this code implemenated.. 我终于实现了这段代码..
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.3'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.1"
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
}
productFlavors {
x86 {
ndk {
abiFilter "x86"
}
}
arm {
ndk {
abiFilters "armeabi-v7a", "armeabi"
}
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/notice.txt'
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.