android-project/app/build.gradle
author Sam Lantinga <slouken@libsdl.org>
Sun, 11 Feb 2018 18:23:37 -0800
changeset 11865 af91d564aa40
parent 11854 934d77867168
child 12128 dfd9a3bda4e4
permissions -rw-r--r--
On Android show the system UI when an SDL window is windowed, hide the system UI when it's fullscreen, like we do on iOS.
We're increasing the Android SDK minimum version to API 19, this doesn't increase the minimum target API, which is API 14.
cole@11854
     1
def buildAsLibrary = project.hasProperty('BUILD_AS_LIBRARY');
cole@11854
     2
def buildAsApplication = !buildAsLibrary
cole@11854
     3
if (buildAsApplication) {
cole@11854
     4
    apply plugin: 'com.android.application'
cole@11854
     5
}
cole@11854
     6
else {
cole@11854
     7
    apply plugin: 'com.android.library'
cole@11854
     8
}
slouken@11647
     9
slouken@11647
    10
android {
slouken@11865
    11
    compileSdkVersion 19
slouken@11649
    12
    buildToolsVersion "26.0.1"
slouken@11647
    13
    defaultConfig {
cole@11854
    14
        if (buildAsApplication) {
cole@11854
    15
            applicationId "org.libsdl.app"
cole@11854
    16
        }
slouken@11649
    17
        minSdkVersion 14
slouken@11865
    18
        targetSdkVersion 19
slouken@11647
    19
        versionCode 1
slouken@11647
    20
        versionName "1.0"
slouken@11649
    21
        externalNativeBuild {
slouken@11649
    22
            ndkBuild {
slouken@11649
    23
                arguments "APP_PLATFORM=android-14"
slouken@11649
    24
            }
slouken@11649
    25
        }
slouken@11647
    26
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
slouken@11647
    27
    }
slouken@11647
    28
    buildTypes {
slouken@11647
    29
        release {
slouken@11647
    30
            minifyEnabled false
slouken@11647
    31
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
slouken@11647
    32
        }
slouken@11647
    33
    }
cole@11854
    34
    if (!project.hasProperty('EXCLUDE_NATIVE_LIBS')) {
cole@11854
    35
        sourceSets.main {
cole@11854
    36
            jniLibs.srcDir 'libs'
slouken@11649
    37
        }
cole@11854
    38
        externalNativeBuild {
cole@11854
    39
            ndkBuild {
cole@11854
    40
                path 'jni/Android.mk'
cole@11854
    41
            }
cole@11854
    42
        }
cole@11854
    43
       
slouken@11647
    44
    }
slouken@11647
    45
    lintOptions {
slouken@11647
    46
        abortOnError false
slouken@11647
    47
    }
cole@11854
    48
    
cole@11854
    49
    if (buildAsLibrary) {
cole@11854
    50
        libraryVariants.all { variant ->
cole@11854
    51
            variant.outputs.each { output ->
cole@11854
    52
                def outputFile = output.outputFile
cole@11854
    53
                if (outputFile != null && outputFile.name.endsWith(".aar")) {
cole@11854
    54
                    def fileName = "org.libsdl.app.aar";
cole@11854
    55
                    output.outputFile = new File(outputFile.parent, fileName);
cole@11854
    56
                }
cole@11854
    57
            }
cole@11854
    58
        }
cole@11854
    59
    }
slouken@11647
    60
}
slouken@11647
    61
slouken@11647
    62
dependencies {
slouken@11649
    63
    compile fileTree(include: ['*.jar'], dir: 'libs')
slouken@11647
    64
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
slouken@11647
    65
        exclude group: 'com.android.support', module: 'support-annotations'
slouken@11647
    66
    })
slouken@11647
    67
    testCompile 'junit:junit:4.12'
slouken@11865
    68
}