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.
     1 def buildAsLibrary = project.hasProperty('BUILD_AS_LIBRARY');
     2 def buildAsApplication = !buildAsLibrary
     3 if (buildAsApplication) {
     4     apply plugin: 'com.android.application'
     5 }
     6 else {
     7     apply plugin: 'com.android.library'
     8 }
     9 
    10 android {
    11     compileSdkVersion 19
    12     buildToolsVersion "26.0.1"
    13     defaultConfig {
    14         if (buildAsApplication) {
    15             applicationId "org.libsdl.app"
    16         }
    17         minSdkVersion 14
    18         targetSdkVersion 19
    19         versionCode 1
    20         versionName "1.0"
    21         externalNativeBuild {
    22             ndkBuild {
    23                 arguments "APP_PLATFORM=android-14"
    24             }
    25         }
    26         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    27     }
    28     buildTypes {
    29         release {
    30             minifyEnabled false
    31             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    32         }
    33     }
    34     if (!project.hasProperty('EXCLUDE_NATIVE_LIBS')) {
    35         sourceSets.main {
    36             jniLibs.srcDir 'libs'
    37         }
    38         externalNativeBuild {
    39             ndkBuild {
    40                 path 'jni/Android.mk'
    41             }
    42         }
    43        
    44     }
    45     lintOptions {
    46         abortOnError false
    47     }
    48     
    49     if (buildAsLibrary) {
    50         libraryVariants.all { variant ->
    51             variant.outputs.each { output ->
    52                 def outputFile = output.outputFile
    53                 if (outputFile != null && outputFile.name.endsWith(".aar")) {
    54                     def fileName = "org.libsdl.app.aar";
    55                     output.outputFile = new File(outputFile.parent, fileName);
    56                 }
    57             }
    58         }
    59     }
    60 }
    61 
    62 dependencies {
    63     compile fileTree(include: ['*.jar'], dir: 'libs')
    64     androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
    65         exclude group: 'com.android.support', module: 'support-annotations'
    66     })
    67     testCompile 'junit:junit:4.12'
    68 }