Skip to content

Instantly share code, notes, and snippets.

View Ehsanul-Hoque's full-sized avatar

Md. Ehsanul Hoque Fahad Ehsanul-Hoque

  • Numrah
View GitHub Profile
@Ehsanul-Hoque
Ehsanul-Hoque / makeApp(Part-6).py
Last active April 10, 2020 19:10
Python code for generating release apk automatically (Part 6)
import json
import sys
# ...
# Main function
def main():
global company_item
global input_company_id
global input_key_filename
@Ehsanul-Hoque
Ehsanul-Hoque / makeApp(Part-5).py
Last active April 9, 2020 08:19
Python code for generating release apk automatically (Part 5)
# Function for generating signed apk
def generateSignedApk():
print('\nGENERATING apk...')
process = Popen('./gradlew assembleRelease', shell=True, stdout=PIPE, stderr=PIPE, universal_newlines=True)
output, errors = process.communicate()
# Zero returncode means process success
if not process.returncode:
print('Signed apk generated!')
return True
@Ehsanul-Hoque
Ehsanul-Hoque / makeApp(Part-4).py
Last active April 5, 2020 18:06
Python code for generating release apk automatically (Part 4)
import requests
# ...
# Function for downloading icon
def downloadIcon(item_dict):
print('\nDOWNLOADING icon file...')
url = item_dict[constants.JSON_KEY_APP_ICON]
try:
r = requests.get(url, allow_redirects=True)
@Ehsanul-Hoque
Ehsanul-Hoque / makeApp(Part-3).py
Last active April 8, 2020 20:10
Python code for generating release apk automatically (Part 3)
import os
from subprocess import Popen, PIPE
# ...
# Function for creating keystore file
def createKeystore(item_dict):
global input_key_filename
global input_store_pass
global input_key_alias
@Ehsanul-Hoque
Ehsanul-Hoque / makeApp(Part-2).py
Last active April 5, 2020 18:03
Python code for generating release apk automatically (Part 2)
import fileinput
# ...
# Function for overwriting gradle.properties file
def overwriteGradleProperties(source_item_dict):
global input_company_id
global app_properties_keys
print('\nOVERWRITING gradle.properties file...')
@Ehsanul-Hoque
Ehsanul-Hoque / makeApp(Part-1).py
Last active April 8, 2020 20:07
Python code for generating release apk automatically (Part 1)
import constants
# Variables
app_properties_keys = [
{"gradle_key": constants.GRADLE_KEY_APP_NAME, "json_key": constants.JSON_KEY_APP_NAME},
{"gradle_key": constants.GRADLE_KEY_APPLICATION_ID, "json_key": constants.JSON_KEY_PACKAGE_NAME},
{"gradle_key": constants.GRADLE_KEY_THEME_COLOR, "json_key": constants.JSON_KEY_THEME_COLOR}
]
# constants.GRADLE_KEY_KEYSTORE_INFO_FILE was not included in this array, because keystore info won't come from json
@Ehsanul-Hoque
Ehsanul-Hoque / constants.py
Last active April 5, 2020 17:41
Constants for automating app
# Constants
COMPANY_INFO_FILE = 'companyInfo.json'
GRADLE_PROPERTIES_FILE = 'gradle.properties'
KEYSTORE_FOLDER = 'keystore/'
KEYSTORE_PROPERTIES_FILE_NAME_SUFFIX = '_keystore.properties'
APP_ICON_FILE = 'app/src/main/res/drawable/app_icon.png'
APP_BUILD_GRADLE_FILE = 'app/build.gradle'
RELEASE_APK_FOLDER = 'app/build/outputs/apk/release/'
RELEASE_APK_FILE_NAME = 'app-release.apk'
@Ehsanul-Hoque
Ehsanul-Hoque / companyInfo.json
Last active April 6, 2020 11:48
Information about the companies to create app automatically
[
{
"id": 1,
"app_name": "Google Genius",
"package_name": "com.ehsanfahad.googlegenius.appautomate",
"theme_color": "#0F9D58",
"app_icon": "https://img.icons8.com/bubbles/2x/google-logo.png",
"keystore_owner": "App Automate Inc.",
"keystore_organizational_unit": "Coding Playground",
"keystore_organization": "Google Inc",
@Ehsanul-Hoque
Ehsanul-Hoque / build.gradle
Last active April 5, 2020 13:08
app level build.gradle file for app automation
// ...
android {
// ...
signingConfigs {
release
}
// To let gradle automate signing process, lintOptions to be added