2016-02-05 03:15:44 +00:00
apply plugin: 'com.android.application'
def getNdkCommandLine ( ndkRoot , target ) {
def gstRoot
if ( project . hasProperty ( 'gstAndroidRoot' ) )
gstRoot = project . gstAndroidRoot
else
2016-09-04 07:12:52 +00:00
throw new GradleException ( '"gstAndroidRoot" must be defined in your gradle properties to the top level directory of the unpacked universal GStreamer Android binaries' )
2016-02-05 03:15:44 +00:00
if ( ndkRoot = = null )
throw new GradleException ( 'NDK not configured' )
return [ "$ndkRoot/ndk-build" ,
'NDK_PROJECT_PATH=build' ,
'APP_BUILD_SCRIPT=src/main/jni/Android.mk' ,
'NDK_APPLICATION_MK=src/main/jni/Application.mk' ,
'GSTREAMER_JAVA_SRC_DIR=src/main/java' ,
"GSTREAMER_ROOT_ANDROID=$gstRoot" ,
target ]
}
android {
compileSdkVersion 23
2016-05-10 19:01:54 +00:00
buildToolsVersion "23.0.3"
2016-02-05 03:15:44 +00:00
sourceSets {
main {
// Avoid using the built in JNI generation plugin
jni . srcDirs = [ ]
jniLibs . srcDirs = [ 'build/libs' ]
}
}
defaultConfig {
applicationId "org.freedesktop.gstreamer.play"
minSdkVersion 15
2016-05-10 19:01:54 +00:00
targetSdkVersion 15
2016-02-05 03:15:44 +00:00
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile ( 'proguard-android.txt' ) , 'proguard-rules.pro'
}
}
// Before compiling our app, prepare NDK code
tasks . withType ( JavaCompile ) {
compileTask - > compileTask . dependsOn ndkBuild
}
// Need to call clean on NDK ourselves too
clean . dependsOn 'ndkClean'
// Build native code using mk files like on Eclipse
task ndkBuild ( type: Exec , description: 'Compile JNI source via NDK' ) {
commandLine getNdkCommandLine ( android . ndkDirectory , 'all' )
}
task ndkClean ( type: Exec , description: 'Clean JNI code built via NDK' ) {
commandLine getNdkCommandLine ( android . ndkDirectory , 'clean' )
}
}
dependencies {
compile fileTree ( dir: 'libs' , include: [ '*.jar' ] )
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
}