You can add below line in your gradle.properties file:
gradle.properties
android.enableR8.fullMode=false