summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Raghavan <git@arunraghavan.net>2016-02-05 08:45:44 +0530
committerArun Raghavan <git@arunraghavan.net>2016-02-11 21:52:44 +0530
commit9b4c565c9a9fb45e7e71eed35fe51f8faf57a9ac (patch)
treef34c79a85bcc591e8fd96aab38a79943a94626ba
parenta1d371f34fb7ff317c1fbff780206530ffab6290 (diff)
android: Move to gradle based build
-rw-r--r--android/.gitignore13
-rw-r--r--android/Makefile.am23
-rw-r--r--android/app/.gitignore4
-rw-r--r--android/app/build.gradle73
-rw-r--r--android/app/proguard-rules.pro17
-rw-r--r--android/app/src/main/AndroidManifest.xml (renamed from android/AndroidManifest.xml)10
-rw-r--r--android/app/src/main/java/org/freedesktop/gstreamer/Player.java (renamed from android/src/org/freedesktop/gstreamer/Player.java)0
-rw-r--r--android/app/src/main/java/org/freedesktop/gstreamer/player/GStreamerSurfaceView.java (renamed from android/src/org/freedesktop/gstreamer/player/GStreamerSurfaceView.java)0
-rw-r--r--android/app/src/main/java/org/freedesktop/gstreamer/player/Play.java (renamed from android/src/org/freedesktop/gstreamer/player/Play.java)0
-rw-r--r--android/app/src/main/jni/Android.mk (renamed from android/jni/Android.mk)0
-rw-r--r--android/app/src/main/jni/Application.mk1
-rw-r--r--android/app/src/main/jni/player.c (renamed from android/jni/player.c)0
-rw-r--r--android/app/src/main/res/layout/main.xml (renamed from android/res/layout/main.xml)0
-rw-r--r--android/app/src/main/res/values/strings.xml (renamed from android/res/values/strings.xml)0
-rw-r--r--android/build.gradle23
-rw-r--r--android/build.xml92
-rw-r--r--android/gradle.properties18
-rw-r--r--android/settings.gradle1
18 files changed, 167 insertions, 108 deletions
diff --git a/android/.gitignore b/android/.gitignore
new file mode 100644
index 0000000..28a30ee
--- /dev/null
+++ b/android/.gitignore
@@ -0,0 +1,13 @@
+*.iml
+.gradle
+/local.properties
+/.idea/workspace.xml
+/.idea/libraries
+.DS_Store
+/build
+/captures
+
+.idea
+gradlew
+gradlew.bat
+gradle/
diff --git a/android/Makefile.am b/android/Makefile.am
index 2664abb..27d8ada 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -1,10 +1,15 @@
EXTRA_DIST = \
- AndroidManifest.xml \
- jni/Android.mk \
- jni/player.c \
- res/layout/main.xml \
- res/values/strings.xml \
- src/org/freedesktop/gstreamer/Player.java \
- src/org/freedesktop/gstreamer/player/GStreamerSurfaceView.java \
- src/org/freedesktop/gstreamer/player/Play.java
-
+ build.gradle \
+ gradle.properties \
+ settings.gradle \
+ app/build.gradle \
+ app/proguard-rules.pro \
+ app/src/main/AndroidManifest.xml \
+ app/src/main/java/org/freedesktop/gstreamer/Player.java \
+ app/src/main/java/org/freedesktop/gstreamer/player/GStreamerSurfaceView.java \
+ app/src/main/java/org/freedesktop/gstreamer/player/Play.java \
+ app/src/main/jni/Android.mk \
+ app/src/main/jni/Application.mk \
+ app/src/main/jni/player.c \
+ app/src/main/res/layout/main.xml \
+ app/src/main/res/values/strings.xml
diff --git a/android/app/.gitignore b/android/app/.gitignore
new file mode 100644
index 0000000..68abc03
--- /dev/null
+++ b/android/app/.gitignore
@@ -0,0 +1,4 @@
+/build
+src/main/java/org/freedesktop/gstreamer/GStreamer.java
+assets/
+gst-build-armeabi/
diff --git a/android/app/build.gradle b/android/app/build.gradle
new file mode 100644
index 0000000..e908022
--- /dev/null
+++ b/android/app/build.gradle
@@ -0,0 +1,73 @@
+apply plugin: 'com.android.application'
+
+
+def getNdkCommandLine(ndkRoot, target) {
+ def gstRoot
+
+ if (project.hasProperty('gstAndroidRoot'))
+ gstRoot = project.gstAndroidRoot
+ else
+ gstRoot = System.properties['user.home'] + '/cerbero/dist/android_arm'
+
+ 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
+ buildToolsVersion "23.0.2"
+
+ sourceSets {
+ main {
+ // Avoid using the built in JNI generation plugin
+ jni.srcDirs = []
+ jniLibs.srcDirs = ['build/libs']
+ }
+ }
+
+ defaultConfig {
+ applicationId "org.freedesktop.gstreamer.play"
+ minSdkVersion 15
+ targetSdkVersion 22
+ 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'
+}
diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro
new file mode 100644
index 0000000..d5d45de
--- /dev/null
+++ b/android/app/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /home/arun/code/android/sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/android/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 41d5652..9823f22 100644
--- a/android/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -1,13 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="org.freedesktop.gstreamer.play"
- android:versionCode="1"
- android:versionName="1.0">
- <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="14"/>
+ package="org.freedesktop.gstreamer.play">
+
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-feature android:glEsVersion="0x00020000"/>
+
<application android:label="@string/app_name">
<activity android:name=".Play"
android:label="@string/app_name">
@@ -174,7 +173,6 @@
<data android:pathPattern=".*\\.XESC" />
<!-- audio -->
-
<data android:pathPattern=".*\\.3ga" />
<data android:pathPattern=".*\\.a52" />
<data android:pathPattern=".*\\.aac" />
@@ -341,8 +339,6 @@
<data android:scheme="udp" />
</intent-filter>
-
-
</activity>
</application>
</manifest>
diff --git a/android/src/org/freedesktop/gstreamer/Player.java b/android/app/src/main/java/org/freedesktop/gstreamer/Player.java
index e2bef8c..e2bef8c 100644
--- a/android/src/org/freedesktop/gstreamer/Player.java
+++ b/android/app/src/main/java/org/freedesktop/gstreamer/Player.java
diff --git a/android/src/org/freedesktop/gstreamer/player/GStreamerSurfaceView.java b/android/app/src/main/java/org/freedesktop/gstreamer/player/GStreamerSurfaceView.java
index 075f035..075f035 100644
--- a/android/src/org/freedesktop/gstreamer/player/GStreamerSurfaceView.java
+++ b/android/app/src/main/java/org/freedesktop/gstreamer/player/GStreamerSurfaceView.java
diff --git a/android/src/org/freedesktop/gstreamer/player/Play.java b/android/app/src/main/java/org/freedesktop/gstreamer/player/Play.java
index 2874f05..2874f05 100644
--- a/android/src/org/freedesktop/gstreamer/player/Play.java
+++ b/android/app/src/main/java/org/freedesktop/gstreamer/player/Play.java
diff --git a/android/jni/Android.mk b/android/app/src/main/jni/Android.mk
index 65e2044..65e2044 100644
--- a/android/jni/Android.mk
+++ b/android/app/src/main/jni/Android.mk
diff --git a/android/app/src/main/jni/Application.mk b/android/app/src/main/jni/Application.mk
new file mode 100644
index 0000000..87c0990
--- /dev/null
+++ b/android/app/src/main/jni/Application.mk
@@ -0,0 +1 @@
+APP_PLATFORM = 15
diff --git a/android/jni/player.c b/android/app/src/main/jni/player.c
index 58d177e..58d177e 100644
--- a/android/jni/player.c
+++ b/android/app/src/main/jni/player.c
diff --git a/android/res/layout/main.xml b/android/app/src/main/res/layout/main.xml
index b745d80..b745d80 100644
--- a/android/res/layout/main.xml
+++ b/android/app/src/main/res/layout/main.xml
diff --git a/android/res/values/strings.xml b/android/app/src/main/res/values/strings.xml
index 9587e3c..9587e3c 100644
--- a/android/res/values/strings.xml
+++ b/android/app/src/main/res/values/strings.xml
diff --git a/android/build.gradle b/android/build.gradle
new file mode 100644
index 0000000..e0b366a
--- /dev/null
+++ b/android/build.gradle
@@ -0,0 +1,23 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:1.5.0'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/android/build.xml b/android/build.xml
deleted file mode 100644
index 4ef18c8..0000000
--- a/android/build.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="gst-play" default="help">
-
- <!-- The local.properties file is created and updated by the 'android' tool.
- It contains the path to the SDK. It should *NOT* be checked into
- Version Control Systems. -->
- <property file="local.properties" />
-
- <!-- The ant.properties file can be created by you. It is only edited by the
- 'android' tool to add properties to it.
- This is the place to change some Ant specific build properties.
- Here are some properties you may want to change/update:
-
- source.dir
- The name of the source directory. Default is 'src'.
- out.dir
- The name of the output directory. Default is 'bin'.
-
- For other overridable properties, look at the beginning of the rules
- files in the SDK, at tools/ant/build.xml
-
- Properties related to the SDK location or the project target should
- be updated using the 'android' tool with the 'update' action.
-
- This file is an integral part of the build system for your
- application and should be checked into Version Control Systems.
-
- -->
- <property file="ant.properties" />
-
- <!-- if sdk.dir was not set from one of the property file, then
- get it from the ANDROID_HOME env var.
- This must be done before we load project.properties since
- the proguard config can use sdk.dir -->
- <property environment="env" />
- <condition property="sdk.dir" value="${env.ANDROID_HOME}">
- <isset property="env.ANDROID_HOME" />
- </condition>
-
- <!-- The project.properties file is created and updated by the 'android'
- tool, as well as ADT.
-
- This contains project specific properties such as project target, and library
- dependencies. Lower level build properties are stored in ant.properties
- (or in .classpath for Eclipse projects).
-
- This file is an integral part of the build system for your
- application and should be checked into Version Control Systems. -->
- <loadproperties srcFile="project.properties" />
-
- <!-- quick check on sdk.dir -->
- <fail
- message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
- unless="sdk.dir"
- />
-
- <!--
- Import per project custom build rules if present at the root of the project.
- This is the place to put custom intermediary targets such as:
- -pre-build
- -pre-compile
- -post-compile (This is typically used for code obfuscation.
- Compiled code location: ${out.classes.absolute.dir}
- If this is not done in place, override ${out.dex.input.absolute.dir})
- -post-package
- -post-build
- -pre-clean
- -->
- <import file="custom_rules.xml" optional="true" />
-
- <!-- Import the actual build file.
-
- To customize existing targets, there are two options:
- - Customize only one target:
- - copy/paste the target into this file, *before* the
- <import> task.
- - customize it to your needs.
- - Customize the whole content of build.xml
- - copy/paste the content of the rules files (minus the top node)
- into this file, replacing the <import> task.
- - customize to your needs.
-
- ***********************
- ****** IMPORTANT ******
- ***********************
- In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
- in order to avoid having your file be overridden by tools such as "android update project"
- -->
- <!-- version-tag: 1 -->
- <import file="${sdk.dir}/tools/ant/build.xml" />
-
-</project>
diff --git a/android/gradle.properties b/android/gradle.properties
new file mode 100644
index 0000000..1d3591c
--- /dev/null
+++ b/android/gradle.properties
@@ -0,0 +1,18 @@
+# Project-wide Gradle settings.
+
+# IDE (e.g. Android Studio) users:
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
+
+# For more details on how to configure your build environment visit
+# http://www.gradle.org/docs/current/userguide/build_environment.html
+
+# Specifies the JVM arguments used for the daemon process.
+# The setting is particularly useful for tweaking memory settings.
+# Default value: -Xmx10248m -XX:MaxPermSize=256m
+# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
+
+# When configured, Gradle will run in incubating parallel mode.
+# This option should only be used with decoupled projects. More details, visit
+# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
+# org.gradle.parallel=true \ No newline at end of file
diff --git a/android/settings.gradle b/android/settings.gradle
new file mode 100644
index 0000000..e7b4def
--- /dev/null
+++ b/android/settings.gradle
@@ -0,0 +1 @@
+include ':app'