How to remove android.enableR8' from the project

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.

Task :unityLibrary:preBuild UP-TO-DATE
Task :unityLibrary:preDebugBuild UP-TO-DATE
Task :launcher:preBuild UP-TO-DATE
Task :launcher:preDebugBuild UP-TO-DATE
Task :unityLibrary:compileDebugAidl NO-SOURCE
Task :launcher:generateDebugBuildConfig UP-TO-DATE
Task :unityLibrary:packageDebugRenderscript NO-SOURCE
Task :launcher:compileDebugAidl NO-SOURCE
Task :unityLibrary:compileDebugRenderscript NO-SOURCE
Task :launcher:compileDebugRenderscript NO-SOURCE
Task :launcher:mainApkListPersistenceDebug UP-TO-DATE
Task :launcher:generateDebugResValues UP-TO-DATE
Task :launcher:generateDebugResources UP-TO-DATE
Task :unityLibrary:generateDebugBuildConfig UP-TO-DATE
Task :launcher:createDebugCompatibleScreenManifests UP-TO-DATE
Task :unityLibrary:generateDebugResValues UP-TO-DATE
Task :unityLibrary:generateDebugResources UP-TO-DATE
Task :launcher:extractDeepLinksDebug UP-TO-DATE
Task :launcher:mergeDebugShaders UP-TO-DATE
Task :launcher:compileDebugShaders UP-TO-DATE
Task :launcher:generateDebugAssets UP-TO-DATE
Task :launcher:processDebugJavaRes NO-SOURCE
Task :unityLibrary:packageDebugResources UP-TO-DATE
Task :unityLibrary:parseDebugLocalResources UP-TO-DATE
Task :launcher:checkDebugDuplicateClasses
Task :unityLibrary:extractDeepLinksDebug UP-TO-DATE
Task :unityLibrary:compileDebugLibraryResources UP-TO-DATE
Task :unityLibrary:mergeDebugShaders UP-TO-DATE
Task :unityLibrary:compileDebugShaders UP-TO-DATE
Task :unityLibrary:generateDebugAssets UP-TO-DATE
Task :unityLibrary:packageDebugAssets
Task :unityLibrary:processDebugJavaRes NO-SOURCE
Task :unityLibrary:bundleLibResDebug UP-TO-DATE
Task :unityLibrary:mergeDebugJniLibFolders
Task :unityLibrary:processDebugManifest
Task :unityLibrary:javaPreCompileDebug
Task :unityLibrary:mergeDebugNativeLibs
Task :unityLibrary:stripDebugDebugSymbols
Task :unityLibrary:copyDebugJniLibsProjectOnly
Task :unityLibrary:generateDebugRFile
Task :unityLibrary:compileDebugJavaWithJavac
Task :unityLibrary:bundleLibRuntimeDebug UP-TO-DATE
Task :unityLibrary:bundleLibCompileDebug
Task :launcher:mergeDebugResources

Task :launcher:processDebugManifest
…Temp\gradleOut\launcher\src\main\AndroidManifest.xml:4:2-98 Warning:
uses-permission#android.permission.READ_EXTERNAL_STORAGE was tagged at AndroidManifest.xml:4 to replace another declaration but no other declaration present

Task :launcher:mergeDebugAssets
Task :launcher:mergeLibDexDebug UP-TO-DATE
Task :launcher:mergeDebugJniLibFolders UP-TO-DATE
Task :launcher:javaPreCompileDebug
Task :launcher:validateSigningDebug UP-TO-DATE
Task :launcher:processDebugResources FAILED
Task :launcher:mergeDebugJavaResource
Task :launcher:mergeDebugNativeLibs
Task :launcher:desugarDebugFileDependencies
39 actionable tasks: 19 executed, 20 up-to-date

UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

I am using unity 2020.3.11f
i can’t build the apk now.

Hi, I am not sure whether you have same issue as mine, this is the error I get in Console:

'> Configure project :launcher

WARNING: The option setting ‘android.enableR8=false’ is deprecated.
It will be removed in version 5.0 of the Android Gradle plugin.
You will no longer be able to disable R8’

But I am able to resolve it and build my apk by follow this 1 (the website is in Chinese),
here is the rough translate:

  • Tick “Custom Base Gradle Template” in [Project Setting] → [Player]
  • Find “baseProjectTemplate.gradle” in your [Project File] → Assets/Plugins/Android
  • change: ‘com.android.tools.build:gradle:3.6.0’ to ‘com.android.tools.build:gradle:3.4.0’

There is picture reference at 1 provided.

Hope this help anyone :slight_smile:

I was getting the “‘android.enableR8’ is deprecated” error when targeting API level 31.

Resolved by setting “Target API Level” to “Android 11.0 (API level 30)”:

187946-enable-r8-solution.png

Unity 2020.3.9f1

In my case, building for the Oculus Quest 2, it helped to switch from il2cpp to mono, build and than swtich again and it was working perfectly.
Unity 2020.3.18f1.

Step 01 : Install GoogleMobileAds plugin and setup and Asset > External Dependency Manager > Android Resolver > resolve. [Optional]


Step 02 : Set Target API Level 30 in Player Setting.


Step 03 : Tick in Custom Main Gradle Template and Custom Launcher Gradle Template.

G02.PNG189017-g02.png


Step 04: How mainTemplate and launcherTemplate files generating. [If not view then first build ignore the errors]

G03.PNG link Image


Step 05 : Added below code into mainTemplate.gradle file with your favorite editor.

buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
// Must be Android Gradle Plugin 3.6.0 or later. For a list of
// compatible Gradle versions refer to:
// https://developer.android.com/studio/releases/gradle-plugin
classpath 'com.android.tools.build:gradle:3.6.0'
}
}

allprojects {
repositories {
google()
mavenCentral()
flatDir {
dirs 'libs'
}
}
}

//Look like that G04.PNG link Image


Step 06 : Download Gradle gradle-5.6.4-all.zip from grdale.org. Download from Gradle Distributions

After download extract the file and set gradle path into Edit > Preference > External Tools > Gradle Install with Unity(recommended) UnChecked

G05.PNG link Image


Step 07 : Build

Helpful Link : Crea per Android 11 con Unity  |  ARCore  |  Google for Developers

I had the same problem, I tried some solutions above and did not work for me. I gave up and I turned off my computer. Next day I tried to build and it worked like nothing was wrong.

Hey @Dradrags
You Should try this Check the Checkbox Ignore Gradle Version under Edit >> Project Settings >> XR-Plugin Management >> AR Core

You can see the Screenshot Below…

For the error:
WARNING: The option setting ‘android.enableR8=false’ is deprecated. It will be removed in version 5.0 of the Android Gradle plugin. You will no longer be able to disable R8’

This happen for me if I copy a project.

→ Deinstall ARCore Package and update it again. For me this worked.

I’ve tried to fix this error for 5 hours. The solution was for me to delete library folder completely, delete all google plugins + all other plugins that can create problems if dublicated/edited etc. Then i just reinstalled everything, after compiling, resolutions, and entering my keystone password… build was done on first try.

I’m just clicked here and fixed.

Edit > Preferences > External Tools > Android SDK Tools Installed with Unity

If you have AppMetrica, AppsFlyer or Facebook SDK in project, just remove folder Plugin. After this, Unity automaticaly repair dependenses. Or use Assets > External Dependancy Manager > Android Resolver > Force Resolve.

The issue is that R8 is enabled so solution is to disable it in the gradle.properties file.


**Follow these steps:**
  • Go to Player settingsPlayer
  • In Publishing Settings sections, check the Custom Gradle Properties Template
  • A new file gradleTemplate.properties will be generated at Assets/Plugins/Android/gradleTemplate.properties
  • Open the file at update value for android.enableR8 to false, so now that line should be android.enableR8=false

Saving the file and rebuilding the app should fix the issue.

Hope it helps.

,The issue is that R8 is enabled so solution is to disable it in the gradle.properties file.

Follow these steps:

  • Go to Player settings → Player
  • In Publishing Settings sections, check the Custom Gradle Properties Template
  • A new file gradleTemplate.properties will be generated at Assets/Plugins/Android/gradleTemplate.properties
  • Open the file at update value for android.enableR8 to false, so now that line should be android.enableR8=false

Saving the file and rebuilding the app should fix the issue.

Hope it helps.

I tried to solve this problem for about 3-4 days but no results,
but finally. HERE IS MY SOLUTION

  1. I installed new Version of unity 2021 LTS.
  2. Installed Android Studio
  3. Installed sdk 33 via android studio
  4. Went to Preferences and Unchecked Android SDK Tools Installed By Unity. And Replaced path of installed sdk in unity to path of installed sdk in step 3.
  5. ticked target API 33

Builded and Everything went GOOD.

same issue:
Unity 2020.3.31
Audience Network Sdk 6.4.0

Fix:
I just imported admob sdk 8.3.0, resolved the dependencies, then built and error was gone, then I deleted admob sdk because i’m not using it. Now there are no errors in the build.