In Android is there a way to generate signed APKs for all modules in a project. E.g. I have following project
Project
-- Library Module
-- Module 1
-- Module 2
-- Module 3
I want to generate APKs for all 3 modules in one command. Currently I have to separately use Generate Dialog for all 3 which takes a lot of time.
Yes you can generate multiple apk files with gradlew.
Open Terminal Window in Android Studio and run following commands:
1- Navigate to root folder of the project, where gradlew file is located
cd ..
2- Give executable permissions to gradlew (this needs to be done only once, no need to repeat again)
chmod a+x gradlew
3- Generate debuggable apks of all underlying modules.
./gradlew assembleDebug
You can also generate release apk files for all modules, by using this command instead
./gradlew assembleRelease
for more details, run the following command to see list of all tasks that can be run on gradlew
./gradlew tasks
Note: Running ./gradlew first time might result in terminal downloading the gradle files from server, wait for the downloading to complete before moving forward!
Hope that helps!
Update: For providing signing information in grade file, Open your module specific build.grade file and update it to contain this code:
signingConfigs {
playstore {
keyAlias 'KEY_ALIS_NAME_HERE'
storeFile file('/PATH_TO_KEYSTORE_FILE_HERE/app.keystore')
keyPassword 'KEY_PASSWORD_HERE'
storePassword 'STORE_PASSWORD_HERE'
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles 'proguard-file.txt'
proguardFile 'proguard-file.txt'
debuggable false
signingConfig signingConfigs.playstore
}
}
After that you can simply run ./gradlew assembleRelease
to do the work :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With