weird error prevent unity building apk PLZ help

hi, when i build for “App bundle(aab)” done successful but when build for APK i get this red error that told me to USE and DO NOT USE the android.enableR8.

“WARNING: The option ‘android.enableR8’ is deprecated and should not be used anymore.
It will be removed in a future version of the Android Gradle plugin, and will no longer allow you to disable R8.
WARNING: DSL element ‘useProguard’ is obsolete and will be removed soon. Use ‘android.enableR8’ in to switch between R8 and Proguard.”


i try multiple solution No luck:


  • add/remove android.enableR8=true from gradleTemplate file .

  • switch android.enableR8 to android.enableD8 .

  • reinstall SDK,gradle,android-ndk-r19,jre .

  • unity version :2019.4.27f1

  • gradle:3.6.0

  • target api level :30

  • custom gradleTemplate enabled

  • custom launcherTemplate enabled

  • custom mainTemplate enabled

  • keystore and keystore password verified.

-some changes apply to those files required by google admob plugin:

any solution ?

3 days ago No 1 comment :frowning:

In 2019.2.21 I solved this by updating gradle version to 3.4.3.
Go to mainTemplate.gradle and update the version there:

classpath ''

But for projects in unity 2020.3 this did not work.