Add pre-built .so files in project using Android Gradle plugin 0.7.3

Solution 1:

So how you can add the pre-built .so files ?

1) Upgrade your android studio to 0.4.0
2) Replace "distributionUrl=" in gradle-wrapper.properties with "distributionUrl=http://services.gradle.org/distributions/gradle-1.9-all.zip"
3) Add/Replace your 'buildscript' section build.gradle with:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.7.3'
    }
} 

4) Add the jniLibs folder in ../src/main/

5) Add the following in your 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.

Solution 2:

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'
}
}