android: Update minimum SDK version to Android 21
[platform/upstream/gstreamer.git] / subprojects / gst-docs / examples / tutorials / android / android-tutorial-1 / build.gradle
1 apply plugin: 'com.android.application'
2
3 android {
4     compileSdkVersion 32
5
6     defaultConfig {
7         applicationId "org.freedesktop.gstreamer.tutorials.tutorial_1"
8         minSdkVersion 21
9         targetSdkVersion 32
10         versionCode 1
11         versionName "1.0"
12
13
14         externalNativeBuild {
15             ndkBuild {
16                 def gstRoot
17
18                 if (project.hasProperty('gstAndroidRoot'))
19                     gstRoot = project.gstAndroidRoot
20                 else
21                     gstRoot = System.env.GSTREAMER_ROOT_ANDROID
22
23                 if (gstRoot == null)
24                     throw new GradleException('GSTREAMER_ROOT_ANDROID must be set, or "gstAndroidRoot" must be defined in your gradle.properties in the top level directory of the unpacked universal GStreamer Android binaries')
25
26                 arguments "NDK_APPLICATION_MK=jni/Application.mk", "GSTREAMER_JAVA_SRC_DIR=src", "GSTREAMER_ROOT_ANDROID=$gstRoot", "GSTREAMER_ASSETS_DIR=src/assets"
27
28                 targets "tutorial-1"
29
30                 // All archs except MIPS and MIPS64 are supported
31                 abiFilters  'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
32             }
33         }
34     }
35
36     buildTypes {
37         release {
38             minifyEnabled false
39             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
40             sourceSets {
41                 main {
42                     manifest.srcFile 'AndroidManifest.xml'
43                     java.srcDirs = ['src']
44                     resources.srcDirs = ['src']
45                     aidl.srcDirs = ['src']
46                     renderscript.srcDirs = ['src']
47                     res.srcDirs = ['res']
48                     assets.srcDirs = ['assets']
49                 }
50             }
51         }
52     }
53
54     externalNativeBuild {
55         ndkBuild {
56             path 'jni/Android.mk'
57         }
58     }
59 }
60
61 afterEvaluate {
62     if (project.hasProperty('compileDebugJavaWithJavac'))
63         project.compileDebugJavaWithJavac.dependsOn 'externalNativeBuildDebug'
64     if (project.hasProperty('compileReleaseJavaWithJavac'))
65         project.compileReleaseJavaWithJavac.dependsOn 'externalNativeBuildRelease'
66 }
67
68 dependencies {
69     implementation fileTree(dir: 'libs', include: ['*.jar'])
70     testImplementation 'junit:junit:4.12'
71     implementation 'com.android.support:appcompat-v7:23.1.1'
72 }