- Home /
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 gradle.properties 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: Assets/Plugins/Android/mainTemplate.gradle Assets/Plugins/Android/launcherTemplate.gradle https://developers.google.com/ar/develop/unity/android-11-build?id#unity_20193_and_20194
any solution ?
Answer by unity_w9c_cN5iZAlu9A · Jun 23, 2021 at 09:09 AM
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 'com.android.tools.build:gradle:3.4.3'
But for projects in unity 2020.3 this did not work.