EDIT1:
Tried to run switchToRelease
task from the answer, but got the following error:
Build file 'D:\dev\repos\Vulkan\android\build.gradle' line: 24
Execution failed for task ':switchToRelease'.
> No signature of method: org.gradle.api.internal.StartParameterInternal.getEnabledProjects() is applicable for argument types: () values: []
CodePudding user response:
You can create a Gradle task to switch all the modules at once. Here are the steps:
Open the build.gradle
file for your project. Add the following code:
task switchToRelease {
doLast {
for (project in gradle.startParameter.getEnabledProjects().toList()) {
project.buildType = "release"
}
}
}
CodePudding user response:
Alternative Answer:-
You can switch all the modules at once by using the command line. Here are the steps:
Open a terminal window in Android Studio.
Change the current directory to your project's root directory.
Run the following command:
./gradlew assembleRelease
This command will build all the modules in your project with the release build type, which is typically optimized for performance and doesn't include debug information.