Add a script for building Android Studio apps

The Android Studio app will be checked out, build and signed with R8,
R8 full mode and Proguard.

The Android Studio project has to be modified to build an unsigned apk
in release mode, and a checked-in keystore file will be used for the
signing with apksigner from the Android SDK build tools.

The three signed apks will be in build/<appname>out/.

Configuration included for one app 'tachiyomi'.

Location of the Android SDK is hardcoded to $HOME/Android/Sdk.

Bug: 119935815
Change-Id: Icf912bb2f6ea3c318622eddc5a9a3dbc87d449c4
diff --git a/tools/apk_utils.py b/tools/apk_utils.py
index a4c0471..aaae1e4 100644
--- a/tools/apk_utils.py
+++ b/tools/apk_utils.py
@@ -3,6 +3,7 @@
 # for details. All rights reserved. Use of this source code is governed by a
 # BSD-style license that can be found in the LICENSE file.
 
+import os
 import subprocess
 import utils
 
@@ -23,3 +24,17 @@
   ]
   utils.PrintCmd(cmd)
   subprocess.check_call(cmd)
+
+def sign_with_apksigner(build_tools_dir, unsigned_apk, signed_apk, keystore, password):
+  cmd = [
+    os.path.join(build_tools_dir, 'apksigner'),
+    'sign',
+    '-v',
+    '--ks', keystore,
+    '--ks-pass', 'pass:' + password,
+    '--min-sdk-version', '19',
+    '--out', signed_apk,
+    unsigned_apk
+  ]
+  utils.PrintCmd(cmd)
+  subprocess.check_call(cmd)