build.gradle 2.22 KB
Newer Older
1 2
apply plugin: 'com.android.library'

3 4

task buildDebugARM(type:Exec) {
5 6 7 8 9 10 11 12 13 14
    /*
    Properties set for Android Studio own shell.
    when you run gradlew from cli, OS shell env variables will be used

    To be able to build from Android Studio, you have to set ndk.dir & sdk.dir
    properties in local.properties in the root folder, like this (for example):
    sdk.dir=/home/<username>/SDK/android-sdk-linux
    ndk.dir=/home/<username>/SDK/android-ndk-r10b
     */
    if (System.getenv('ANDROID_SDK') == null || System.getenv('ANDROID_NDK') == null) {
15 16 17 18
        Properties properties = new Properties()
        properties.load(project.rootProject.file('local.properties').newDataInputStream())
        environment 'ANDROID_NDK', properties.getProperty('ndk.dir')
        environment 'ANDROID_SDK', properties.getProperty('sdk.dir')
19 20
    }
    workingDir '..'
Geoffrey Métais's avatar
Geoffrey Métais committed
21
    commandLine './compile-libvlc.sh'
22
    args('-a', "armeabi-v7a")
23
}
24
task buildDebugx86(type:Exec) {
25
    if (System.getenv('ANDROID_SDK') == null || System.getenv('ANDROID_NDK') == null) {
26 27 28 29
        Properties properties = new Properties()
        properties.load(project.rootProject.file('local.properties').newDataInputStream())
        environment 'ANDROID_NDK', properties.getProperty('ndk.dir')
        environment 'ANDROID_SDK', properties.getProperty('sdk.dir')
30 31
    }
    workingDir '..'
Geoffrey Métais's avatar
Geoffrey Métais committed
32
    commandLine './compile-libvlc.sh'
33
    args('-a', "x86")
34 35
}

36
android {
37 38
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion
39 40 41

    sourceSets {
    main {
Edward Wang's avatar
Edward Wang committed
42
        jni.srcDirs = [] // Prevent gradle from building native code with ndk; we have our own Makefile for it.
43
        jniLibs.srcDir 'jni/libs' // Where generated .so files are placed.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src']
        resources.srcDirs = ['src']
        aidl.srcDirs = ['src']
        renderscript.srcDirs = ['src']
        res.srcDirs = ['res']
        assets.srcDirs = ['assets']
    }
    }

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 21
    }

    buildTypes {
        release {
61
            minifyEnabled false
62 63 64 65
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}