The option 'android.enableR8' is deprecated and should not be used anymore. It will be removed in a future version of the Android Gradle
Asked Answered
M

4

6

Hi everyone hope you guys well!

So here is the deal; I have an android unity project which has not extra plugin or SDK. When I am going to try to build project, this error appears. I'm stuck with this :(

Tried With this versions;

Unity Version:2021.3.5f1 ,2020.3.25f1

Gradle version: Built-in, 7.4.2, 6.2, 7.0.2

JDK-NDK-SDK: Built-in

Configure project :launcher 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.

I Was tried almost everything on this forum or others nothings changed, Now I'm searching for strange files in project folder.

Am I missing something ?

Moss answered 29/8, 2022 at 7:4 Comment(0)
U
5

Suggestions:

Download gradle version 6+ and go to preferences and give the path to that directory where you have downloaded the new gradle then go to Player publishing settings and uncheck any custom gradle or manifest (if they are checked) then check and delete files androidManifest and baseGradleTemplate from Plugins/Android then again check those boxes (again only if you were using any custom gradle template or manifest file before) then it will regenerate your manifest and baseGradleTemplate in Plugins/Android folder so then delete resolved libraries and then resolve the packages (if you are using extenrnal dependency manager) and then build the applcation.

Hopefully it will work, happy coding :)

Urbanism answered 29/8, 2022 at 10:20 Comment(2)
Thanks for sharing your knowledge Sherry! like you said I was upgrade my gradle version to 6.9 which is works fine :) but also need to comment "androidR8.enabled = true;" custom gradle properties. And finally everything is working right now!Moss
you are very welcome and glad that you have found solution for yourselfUrbanism
X
3

I use Unity 2021.3, project includes Firebase, Admob, Ironsource. I did follow this steps and it's worked

  • Delete folder: <PROJECT_FOLDER>\Library\Bee\Android
  • Android Resolver > Force Resolve
  • Build again

Hope this helps!

Xray answered 26/11, 2022 at 14:2 Comment(0)
K
2

Solution for following errors:

  1. Unity Build Error: Missing 'package' key attribute on element package at [:arcore_client:] AndroidManifest.xml
  2. The option 'android.enableR8' is deprecated and should not be used anymore.

Set your Minimum API level to 29 Target API Level should be 31 or 34

In Publishing Settings under Build you want to activate the following:

  • Custom Main Manifest
  • Custom Main Gradle Template
  • Custom Launcher Gradle Template
  • Custom Gradle Properties Template

Then edit the AndroidManifest.xml that is created by:

  • Removing the comment 'GENERATED BY UNITY'
  • Under the tag edit the first tag to include the following: android:exported="true"

Then edit the baseProjectTemplate.gradle that was created by:

  • Removing the comment 'GENERATED BY UNITY'
  • Modify classpath for android tools to the following: classpath 'com.android.tools.build:gradle:4.0.1'
Kolosick answered 14/7, 2023 at 14:21 Comment(0)
S
0

In my case the problem was that I used 2 plugins that had conflicting dependencies and the Android Resolver didn't handle this case properly. I spent a lot of time trying to resolve the dependencies manually which did not go well. What finally worked was to start a clean project and then import my plugins one by one and then build the project. Do that until you find which plugins do not work correctly together or (like in my case) hope that the Resolver will properly resolve everything correctly if you do it one by one. Hope this helps someone in the future.

Spenser answered 3/5, 2023 at 20:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.