My project has dynamic feature module and I would like to generate debug or release APK including the dynamic feature. Currently I can get only base APK file.
Basica
I don't see it documented anywhere, but the Android Gradle build tools include tasks to extract the universal APK for you. You can use something similar to:
./gradlew :yourmodule:packageDebugUniversalApk
Under the hood it uses bundletool and does essentially the same thing as the other answer, but it's nice to be able to do it from Gradle.