当前位置:   article > 正文

【Unity打包Android】Gradle报错,Deprecated Gradle features were used in this build ···_it was removed in version 4.0 of the android gradl

it was removed in version 4.0 of the android gradle plugin. this feature was
Unity 2020.3.41f1c1 打包Android

加入Google Admob广告SDK后,打包Android失败,具体报错如下:

报错1:
  1. Starting a Gradle Daemon, 2 stopped Daemons could not be reused, use --status for details
  2. > Configure project :launcher
  3. WARNING: The option setting 'android.enableR8=false' is deprecated.
  4. It will be removed in version 5.0 of the Android Gradle plugin.
  5. You will no longer be able to disable R8
  6. ============================================================================
  7. AppLovin Quality Service Plug-in for Gradle and Android Studio Version 5.4.4
  8. Copyright (c) 2024 AppLovin Ltd. All rights reserved.
  9. ============================================================================
  10. > Task :launcher:preBuild UP-TO-DATE
  11. > Task :launcher:preReleaseBuild UP-TO-DATE
  12. > Task :unityLibrary:preBuild UP-TO-DATE
  13. > Task :unityLibrary:preReleaseBuild UP-TO-DATE
  14. > Task :unityLibrary:packageReleaseRenderscript NO-SOURCE
  15. > Task :unityLibrary:compileReleaseAidl NO-SOURCE
  16. > Task :launcher:generateReleaseBuildConfig UP-TO-DATE
  17. > Task :launcher:compileReleaseAidl NO-SOURCE
  18. > Task :launcher:compileReleaseRenderscript NO-SOURCE
  19. > Task :launcher:javaPreCompileRelease UP-TO-DATE
  20. > Task :launcher:generateReleaseResValues UP-TO-DATE
  21. > Task :launcher:generateReleaseResources UP-TO-DATE
  22. > Task :unityLibrary:generateReleaseResValues UP-TO-DATE
  23. > Task :unityLibrary:compileReleaseRenderscript NO-SOURCE
  24. > Task :unityLibrary:generateReleaseResources UP-TO-DATE
  25. > Task :launcher:createReleaseCompatibleScreenManifests UP-TO-DATE
  26. > Task :launcher:extractDeepLinksRelease UP-TO-DATE
  27. > Task :unityLibrary:packageReleaseResources UP-TO-DATE
  28. > Task :unityLibrary:extractDeepLinksRelease UP-TO-DATE
  29. > Task :launcher:mergeReleaseResources UP-TO-DATE
  30. > Task :launcher:prepareLintJar UP-TO-DATE
  31. > Task :unityLibrary:compileReleaseLibraryResources UP-TO-DATE
  32. > Task :unityLibrary:parseReleaseLocalResources UP-TO-DATE
  33. > Task :unityLibrary:generateReleaseBuildConfig UP-TO-DATE
  34. > Task :unityLibrary:javaPreCompileRelease UP-TO-DATE
  35. > Task :unityLibrary:prepareLintJarForPublish UP-TO-DATE
  36. > Task :unityLibrary:mergeReleaseShaders UP-TO-DATE
  37. > Task :launcher:checkReleaseDuplicateClasses UP-TO-DATE
  38. > Task :unityLibrary:compileReleaseShaders NO-SOURCE
  39. > Task :unityLibrary:generateReleaseAssets UP-TO-DATE
  40. > Task :launcher:mergeReleaseShaders UP-TO-DATE
  41. > Task :launcher:compileReleaseShaders NO-SOURCE
  42. > Task :launcher:generateReleaseAssets UP-TO-DATE
  43. > Task :launcher:processReleaseJavaRes NO-SOURCE
  44. > Task :launcher:mergeReleaseJniLibFolders
  45. > Task :unityLibrary:packageReleaseAssets
  46. > Task :unityLibrary:processReleaseJavaRes NO-SOURCE
  47. > Task :unityLibrary:bundleLibResRelease NO-SOURCE
  48. > Task :unityLibrary:processReleaseManifest
  49. > Task :unityLibrary:generateReleaseRFile UP-TO-DATE
  50. > Task :unityLibrary:compileReleaseJavaWithJavac UP-TO-DATE
  51. > Task :unityLibrary:bundleLibCompileToJarRelease UP-TO-DATE
  52. > Task :unityLibrary:bundleLibRuntimeToJarRelease UP-TO-DATE
  53. > Task :unityLibrary:mergeReleaseJniLibFolders UP-TO-DATE
  54. > Task :unityLibrary:mergeReleaseNativeLibs
  55. > Task :unityLibrary:stripReleaseDebugSymbols
  56. > Task :launcher:collectReleaseDependencies
  57. > Task :unityLibrary:copyReleaseJniLibsProjectOnly
  58. > Task :launcher:processReleaseManifest
  59. > Task :launcher:processReleaseResources FAILED
  60. Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
  61. Use '--warning-mode all' to show the individual deprecation warnings.
  62. See https://docs.gradle.org/6.1.1/userguide/command_line_interface.html#sec:command_line_warnings
  63. 32 actionable tasks: 9 executed, 23 up-to-date
  64. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)
报错2:
  1. Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
  2. Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
  3. Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
  4. Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
  5. Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
  6. Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
  7. Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
  8. Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
  9. Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
  10. Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
  11. Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
  12. Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
  13. Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
  14. Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
  15. Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
  16. Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
  17. Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
  18. Warning: ??????????????? (uri:"", local:"extension-level")??????????????????<{}codename>,<{}layoutlib>,<{}api-level>
  19. Warning: ??????????????? (uri:"", local:"base-extension")??????????????????<{}codename>,<{}layoutlib>,<{}api-level>
  20. FAILURE: Build failed with an exception.
  21. * What went wrong:
  22. Execution failed for task ':launcher:processReleaseResources'.
  23. > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
  24.    > Android resource linking failed
  25.      /Users/zcs/Desktop/AppLovin/Temp/gradleOut/unityLibrary/build/intermediates/library_manifest/release/AndroidManifest.xml:83:13-33: AAPT: error: unexpected element <property> found in <manifest><application>.
  26.          
  27. * Try:
  28. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  29. * Get more help at https://help.gradle.org
  30. BUILD FAILED in 16s
  31. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)
报错3:
  1. CommandInvokationFailure: Gradle build failed. 
  2. /Applications/Unity/Hub/Editor/2020.3.41f1c1/PlaybackEngines/AndroidPlayer/OpenJDK/bin/java -classpath "/Applications/Unity/Hub/Editor/2020.3.41f1c1/PlaybackEngines/AndroidPlayer/Tools/gradle/lib/gradle-launcher-6.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease"
  3. Environment Variables:
  4. XPC_SERVICE_NAME = application.com.unity3d.unityhub.115064992.115064998
  5. ORIGINAL_XDG_CURRENT_DESKTOP = undefined
  6. XPC_FLAGS = 0x0
  7. JAVA_TOOL_OPTIONS = -Dfile.encoding=UTF-8
  8. PATH = /usr/local/opt/ruby/bin:/usr/local/bin:/usr/local/sbin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/zcs/.rvm/bin
  9. TMPDIR = /var/folders/h0/fcqx86812z52g1cp20nnnk8r0000gn/T/
  10. SHELL = /bin/zsh
  11. SSH_AUTH_SOCK = /private/tmp/com.apple.launchd.pSygouVyl8/Listeners
  12. HOME = /Users/zcs
  13. __CFBundleIdentifier = com.unity3d.unityhub
  14. USER = zcs
  15. __CF_USER_TEXT_ENCODING = 0x1F5:0x19:0x34
  16. LOGNAME = zcs
  17. JAVA_HOME = /Applications/Unity/Hub/Editor/2020.3.41f1c1/PlaybackEngines/AndroidPlayer/OpenJDK
  18. COMMAND_MODE = unix2003
  19. stderr[
  20. Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
  21. Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
  22. Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
  23. Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
  24. Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
  25. Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
  26. Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
  27. Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
  28. Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
  29. Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
  30. Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
  31. Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
  32. Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
  33. Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
  34. Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
  35. Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
  36. Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
  37. Warning: ??????????????? (uri:"", local:"extension-level")??????????????????<{}codename>,<{}layoutlib>,<{}api-level>
  38. Warning: ??????????????? (uri:"", local:"base-extension")??????????????????<{}codename>,<{}layoutlib>,<{}api-level>
  39. FAILURE: Build failed with an exception.
  40. * What went wrong:
  41. Execution failed for task ':launcher:processReleaseResources'.
  42. > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
  43.    > Android resource linking failed
  44.      /Users/zcs/Desktop/AppLovin/Temp/gradleOut/unityLibrary/build/intermediates/library_manifest/release/AndroidManifest.xml:83:13-33: AAPT: error: unexpected element <property> found in <manifest><application>.
  45.          
  46. * Try:
  47. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  48. * Get more help at https://help.gradle.org
  49. BUILD FAILED in 16s
  50. ]
  51. stdout[
  52. Starting a Gradle Daemon, 2 stopped Daemons could not be reused, use --status for details
  53. > Configure project :launcher
  54. WARNING: The option setting 'android.enableR8=false' is deprecated.
  55. It will be removed in version 5.0 of the Android Gradle plugin.
  56. You will no longer be able to disable R8
  57. ============================================================================
  58. AppLovin Quality Service Plug-in for Gradle and Android Studio Version 5.4.4
  59. Copyright (c) 2024 AppLovin Ltd. All rights reserved.
  60. ============================================================================
  61. > Task :launcher:preBuild UP-TO-DATE
  62. > Task :launcher:preReleaseBuild UP-TO-DATE
  63. > Task :unityLibrary:preBuild UP-TO-DATE
  64. > Task :unityLibrary:preReleaseBuild UP-TO-DATE
  65. > Task :unityLibrary:packageReleaseRenderscript NO-SOURCE
  66. > Task :unityLibrary:compileReleaseAidl NO-SOURCE
  67. > Task :launcher:generateReleaseBuildConfig UP-TO-DATE
  68. > Task :launcher:compileReleaseAidl NO-SOURCE
  69. > Task :launcher:compileReleaseRenderscript NO-SOURCE
  70. > Task :launcher:javaPreCompileRelease UP-TO-DATE
  71. > Task :launcher:generateReleaseResValues UP-TO-DATE
  72. > Task :launcher:generateReleaseResources UP-TO-DATE
  73. > Task :unityLibrary:generateReleaseResValues UP-TO-DATE
  74. > Task :unityLibrary:compileReleaseRenderscript NO-SOURCE
  75. > Task :unityLibrary:generateReleaseResources UP-TO-DATE
  76. > Task :launcher:createReleaseCompatibleScreenManifests UP-TO-DATE
  77. > Task :launcher:extractDeepLinksRelease UP-TO-DATE
  78. > Task :unityLibrary:packageReleaseResources UP-TO-DATE
  79. > Task :unityLibrary:extractDeepLinksRelease UP-TO-DATE
  80. > Task :launcher:mergeReleaseResources UP-TO-DATE
  81. > Task :launcher:prepareLintJar UP-TO-DATE
  82. > Task :unityLibrary:compileReleaseLibraryResources UP-TO-DATE
  83. > Task :unityLibrary:parseReleaseLocalResources UP-TO-DATE
  84. > Task :unityLibrary:generateReleaseBuildConfig UP-TO-DATE
  85. > Task :unityLibrary:javaPreCompileRelease UP-TO-DATE
  86. > Task :unityLibrary:prepareLintJarForPublish UP-TO-DATE
  87. > Task :unityLibrary:mergeReleaseShaders UP-TO-DATE
  88. > Task :launcher:checkReleaseDuplicateClasses UP-TO-DATE
  89. > Task :unityLibrary:compileReleaseShaders NO-SOURCE
  90. > Task :unityLibrary:generateReleaseAssets UP-TO-DATE
  91. > Task :launcher:mergeReleaseShaders UP-TO-DATE
  92. > Task :launcher:compileReleaseShaders NO-SOURCE
  93. > Task :launcher:generateReleaseAssets UP-TO-DATE
  94. > Task :launcher:processReleaseJavaRes NO-SOURCE
  95. > Task :launcher:mergeReleaseJniLibFolders
  96. > Task :unityLibrary:packageReleaseAssets
  97. > Task :unityLibrary:processReleaseJavaRes NO-SOURCE
  98. > Task :unityLibrary:bundleLibResRelease NO-SOURCE
  99. > Task :unityLibrary:processReleaseManifest
  100. > Task :unityLibrary:generateReleaseRFile UP-TO-DATE
  101. > Task :unityLibrary:compileReleaseJavaWithJavac UP-TO-DATE
  102. > Task :unityLibrary:bundleLibCompileToJarRelease UP-TO-DATE
  103. > Task :unityLibrary:bundleLibRuntimeToJarRelease UP-TO-DATE
  104. > Task :unityLibrary:mergeReleaseJniLibFolders UP-TO-DATE
  105. > Task :unityLibrary:mergeReleaseNativeLibs
  106. > Task :unityLibrary:stripReleaseDebugSymbols
  107. > Task :launcher:collectReleaseDependencies
  108. > Task :unityLibrary:copyReleaseJniLibsProjectOnly
  109. > Task :launcher:processReleaseManifest
  110. > Task :launcher:processReleaseResources FAILED
  111. Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
  112. Use '--warning-mode all' to show the individual deprecation warnings.
  113. See https://docs.gradle.org/6.1.1/userguide/command_line_interface.html#sec:command_line_warnings
  114. 32 actionable tasks: 9 executed, 23 up-to-date
  115. ]
  116. exit code: 1
  117. UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <7548ac0715314377a741890edb01278e>:0)
  118. UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <7548ac0715314377a741890edb01278e>:0)
  119. UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <7548ac0715314377a741890edb01278e>:0)
  120. UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <7548ac0715314377a741890edb01278e>:0)
  121. UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <7548ac0715314377a741890edb01278e>:0)
  122. Rethrow as GradleInvokationException: Gradle build failed
  123. UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <7548ac0715314377a741890edb01278e>:0)
  124. UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <7548ac0715314377a741890edb01278e>:0)
  125. UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <7548ac0715314377a741890edb01278e>:0)
  126. Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
  127. UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) (at <7548ac0715314377a741890edb01278e>:0)
  128. UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <7548ac0715314377a741890edb01278e>:0)
  129. UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <7548ac0715314377a741890edb01278e>:0)
  130. UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <7548ac0715314377a741890edb01278e>:0)
  131. UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:337)
  132. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)
 原因:

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.

// 查看Unity预装的Gradle版本

https://docs.unity3d.com/Manual/android-gradle-overview.html

// 查看官方Gradle和Android Gradle Plugin兼容性

https://developer.android.com/studio/releases/gradle-plugin#updating-gradle

Unity 2020.3.41f1c1默认Gradle版本是4.0.1,可在下图中查看,Admob中使用了新的Gradle特性,默认Gradle不支持,导致打包失败

解决:

 升级Gradle版本,或者升级Unity版本。

 升级Gradle

1. 自定义Gradle配置文件

1.1 Project Settings => Player => 勾选Custom Base Gradle Template、Custom Gradle Properties Template

Unity会在Assets/Plugins/Android路径生成Gradle文件,baseProjectTemplate.gradle、gradleTemplate.properties

1.2 勾选Use R8

不勾选会有以下报错:

  1. * What went wrong:
  2. A problem occurred evaluating project ':launcher'.
  3. > Failed to apply plugin 'com.android.internal.application'.
  4.    > com.android.builder.errors.EvalIssueException: The option 'android.enableR8' is deprecated.
  5.      It was removed in version 7.0 of the Android Gradle plugin.
  6.      Please remove it from `gradle.properties`.

 2. 修改Gradle plug-in 版本

打开Assets/Plugins/Android/baseProjectTemplate.gradle文件,修改Gradle plug-in版本号为7.3.0

3. 修改Gradle版本

3.1 下载对应版本的Gradle版本下载链接 Gradle | ReleasesFind binaries and reference documentation for current and past versions of Gradle.icon-default.png?t=N7T8https://gradle.org/releases/

3.2 Setting => Preferences => External Tools => 勾选Gradle Installed with Unity 

选择下载解压到本地Gradle文件夹

4. 修改JDK版本

4.1 下载安装对应版本的JDK

下载链接 Java Downloads | Oracleicon-default.png?t=N7T8https://www.oracle.com/java/technologies/downloads/#java11-mac

4.2 打开Assets/Plugins/Android/gradleTemplate.properties文件,修改新的JDK路径(绝对路径)

不需要勾选External Tools => JDK Installed with Unity,打包时会使用配置文件中的路径

  1. org.gradle.jvmargs=-Xmx**JVM_HEAP_SIZE**M
  2. org.gradle.parallel=true
  3. unityStreamingAssets=.unity3d**STREAMING_ASSETS**
  4. # Android Resolver Properties Start
  5. android.useAndroidX=true
  6. android.enableJetifier=true
  7. # Android Resolver Properties End
  8. **ADDITIONAL_PROPERTIES**
  9. android.overridePathCheck=true
  10. org.gradle.java.home=/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home
  11. android.enableR8=**MINIFY_WITH_R_EIGHT**

 操作完成后即可开始打包~

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/正经夜光杯/article/detail/1004765
推荐阅读
相关标签
  

闽ICP备14008679号