Created
August 30, 2019 17:12
-
-
Save GabriellCosta/5dafb81258196c82d6025252b22e730d to your computer and use it in GitHub Desktop.
New Android Module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//The basic configuration for your module build.gradle here | |
//change {YOUR_PACKAGE_NAME_HERE} with the your package name, DO NOT REMOVE .moduleName | |
<?xml version="1.0" encoding="utf-8"?> | |
<manifest package="{YOUR_PACKAGE_NAME_HERE}.moduleName"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//The basic configuration for your module build.gradle here | |
apply plugin: "com.android.library" | |
apply plugin: 'kotlin-android' | |
apply plugin: 'kotlin-android-extensions' | |
apply plugin: 'kotlin-kapt' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BASEDIR=$(dirname "$0") | |
echo "module name" | |
read moduleName | |
echo "Where module is located?" | |
read moduleLocation | |
mkdir -p $moduleLocation/$moduleName | |
#Create build.gradle file in module | |
cp $BASEDIR/build.gradle $moduleLocation/$moduleName/build.gradle | |
#Create base src folder in module | |
mkdir -p $moduleLocation/$moduleName/src/main/kotlin | |
#Create a AndroidManifest in module | |
cp $BASEDIR/AndroidManifest.xml $moduleLocation/$moduleName/src/main/AndroidManifest.xml | |
#Add the given module name to package name in androidManifest | |
sed -i "s/moduleName/$moduleLocation.$moduleName/" $moduleLocation/$moduleName/src/main/AndroidManifest.xml | |
#Create .gitignore file in module | |
cp $BASEDIR/.gitignore $moduleLocation/$moduleName/.gitignore | |
echo "add :$moduleLocation:$moduleName to settings.gradle" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Put all this files inside a folder, than use
moduleMaker.sh
In my project they are located in Android_Project/tools/moduleMaker