build: Correct app version and enable automated upload to Google Play

Change-Id: I253bb795b65dfc4cff52c244c824d42f7fc71c17
diff --git a/app/build.gradle b/app/build.gradle
index 57b585b..9695397 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -10,8 +10,8 @@
         applicationId "net.named_data.nfd"
         minSdkVersion 15
         targetSdkVersion 19
-        versionCode 2001
-        versionName "0.2.1"
+        versionCode 3005
+        versionName "0.3.4"
     }
     compileOptions {
         sourceCompatibility JavaVersion.VERSION_1_7
@@ -45,7 +45,7 @@
     splits {
         abi {
             enable true // enable ABI split feature to create one APK per ABI
-            universalApk true //generate an additional APK that targets all the ABIs
+            universalApk false // don't generate an additional APK that targets all the ABIs
         }
     }
 
@@ -110,12 +110,14 @@
     return ndk_build
 }
 
+
 def getNdkDir() {
     if (System.env.ANDROID_NDK_ROOT != null)
         return System.env.ANDROID_NDK_ROOT
 
     Properties properties = new Properties()
     properties.load(project.rootProject.file('local.properties').newDataInputStream())
+
     def ndk_dir = properties.getProperty('ndk.dir', null)
     if (ndk_dir == null) {
         throw new GradleException("NDK location not found. Define location with ndk.dir in the local.properties file or with an ANDROID_NDK_ROOT environment variable.")
@@ -153,3 +155,37 @@
     compile 'net.named-data.jndn-xx:jndn-xx-util:0.0.1'
     compile 'joda-time:joda-time:2.7'
 }
+
+Properties properties = new Properties()
+properties.load(project.rootProject.file('local.properties').newDataInputStream())
+
+if (properties['keystore'] == null || properties['keystore.password'] == null ||
+    properties['keystore.key.alias'] == null || properties['keystore.key.password'] == null) {
+    println("Cannot sign .apk: specify keystore, keystore.password, keystore.key.alias, and keystore.key.password in local.properties.")
+}
+else {
+    android {
+        signingConfigs {
+            release {
+                storeFile file(properties['keystore'])
+                storePassword properties['keystore.password']
+                keyAlias properties['keystore.key.alias']
+                keyPassword properties['keystore.key.password']
+            }
+        }
+        buildTypes {
+            release {
+                signingConfig signingConfigs.release
+            }
+        }
+    }
+}
+
+if (properties['google-play'] != null) {
+    apply plugin: 'net.named-data.playground.play'
+
+    play {
+        track = 'alpha'
+        jsonFile = file(properties['google-play'])
+    }
+}