Gradle build failed while targeting API 26

I want to target Oreo 8.0 (API 26) for android build, but it is throwing me Gradle build error. I tried using the Inbuilt gradle provided in Unity 2021.3.24f1 but it gave same error so I used gradle-6.9.4 but gives me same gradle build error. Earlier I tried building for API 33 which got successfully built.

Here is the detailed description of my error:

CommandInvokationFailure: Gradle build failed.
C:\Program Files\Unity\Hub\Editor\2021.3.24f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK\bin\java.exe -classpath “I:\gradle\gradle-6.9.4\lib\gradle-launcher-6.9.4.jar” org.gradle.launcher.GradleMain “-Dorg.gradle.jvmargs=-Xmx4096m” “assembleRelease”

Environment Variables:
RegionCode = APJ
USERDOMAIN = LAPTOP-HM2U5VS3
ProgramFiles = C:\Program Files
Java = C:\Program Files\Java\jdk-13.0.2\bin
TMP = C:\Users\Jesal\AppData\Local\Temp
PROCESSOR_ARCHITECTURE = AMD64
PROCESSOR_REVISION = 4e03
OneDriveConsumer = C:\Users\Jesal\OneDrive
OS = Windows_NT
CHROME_CRASHPAD_PIPE_NAME = \.\pipe\crashpad_5552_QZJOMJABRLNBYBRR
PROCESSOR_IDENTIFIER = Intel64 Family 6 Model 78 Stepping 3, GenuineIntel
AMPLITUDE_API_KEY = 28f3cae0b33b8b3702120c9ed1a935aa
USERPROFILE = C:\Users\Jesal
JAVA_HOME = C:\Program Files\Unity\Hub\Editor\2021.3.24f1\Editor\Data\PlaybackEngines\AndroidPlayer\OpenJDK
CommonProgramFiles = C:\Program Files\Common Files
DriverData = C:\Windows\System32\Drivers\DriverData
ComSpec = C:\WINDOWS\system32\cmd.exe
LAUNCH_DARKLY_CLIENT_TOKEN = 60a7e30fafc7e60e33446283
PSModulePath = C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
PUBLIC = C:\Users\Public
SystemRoot = C:\WINDOWS
HEAP_CLIENT_TOKEN = 1717415662
platformcode = KV
NUMBER_OF_PROCESSORS = 4
WOOTRIC_CLIENT_TOKEN = NPS-aa8be4c3
JAVA_TOOL_OPTIONS = -Dfile.encoding=UTF-8
DEBUG_ENV_VAR = UnityHub
ProgramW6432 = C:\Program Files
FPS_BROWSER_APP_PROFILE_STRING = Internet Explorer
TEMP = C:\Users\Jesal\AppData\Local\Temp
Path = C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\WINDOWS\System32\OpenSSH;C:\Program Files\dotnet;C:\Program Files\Java\jdk1.8.0_202\bin;C:\Users\Jesal\AppData\Local\Programs\Python\Python39\Scripts;C:\Users\Jesal\AppData\Local\Programs\Python\Python39;C:\Users\Jesal\AppData\Local\Microsoft\WindowsApps;C:\Users\Jesal\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Jesal.dotnet ools;C:\Program Files\Java\jdk1.8.0_77\bin;
USERNAME = Jesal
COMPUTERNAME = LAPTOP-HM2U5VS3
USERDOMAIN_ROAMINGPROFILE = LAPTOP-HM2U5VS3
PATHEXT = .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
SystemDrive = C:
ALLUSERSPROFILE = C:\ProgramData
SENTRY_ACCESS_TOKEN = 3df78d9e53f8456aa90fbae044ce1a6261421ab1d0014674bc2e933477289017
OnlineServices = Online Services
HEAP_CLIENT_TOKEN_STAGING = 3786794399
FPS_BROWSER_USER_PROFILE_STRING = Default
windir = C:\WINDOWS
AMPLITUDE_API_KEY_STAGING = 83ee04fccc67e4fcc7dd527c4c6f1e21
CommonProgramFiles(x86) = C:\Program Files (x86)\Common Files
APPDATA = C:\Users\Jesal\AppData\Roaming
PROCESSOR_LEVEL = 6
CommonProgramW6432 = C:\Program Files\Common Files
ProgramFiles(x86) = C:\Program Files (x86)
SESSIONNAME = Console
LOGONSERVER = \LAPTOP-HM2U5VS3
LOCALAPPDATA = C:\Users\Jesal\AppData\Local
HOMEPATH = \Users\Jesal
LAUNCH_DARKLY_CLIENT_TOKEN_STAGING = 60a7e30fafc7e60e33446282
HOMEDRIVE = C:
OneDrive = C:\Users\Jesal\OneDrive
ProgramData = C:\ProgramData
ORIGINAL_XDG_CURRENT_DESKTOP = undefined

stderr[
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
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
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
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
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
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
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
Warning: unexpected element (uri:“”, local:“base-extension”). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:launcher:processReleaseResources’.

A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Android resource linking failed
C:\Users\Jesal\MatrixInside\Library\Bee\Android\Prj\IL2CPP\Gradle\launcher\build\intermediates\incremental\mergeReleaseResources\merged.dir\values\values.xml:343: AAPT: error: resource android:attr/fontVariationSettings not found.

 C:\Users\Jesal\MatrixInside\Library\Bee\Android\Prj\IL2CPP\Gradle\launcher\build\intermediates\incremental\mergeReleaseResources\merged.dir\values\values.xml:344: AAPT: error: resource android:attr/ttcIndex not found.
  • Try:
    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.

  • Get more help at https://help.gradle.org

BUILD FAILED in 38s
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
]
stdout[

Task :launcher:preBuild UP-TO-DATE
Task :launcher:preReleaseBuild UP-TO-DATE
Task :unityLibrary:preBuild UP-TO-DATE
Task :unityLibrary:preReleaseBuild UP-TO-DATE
Task :unityLibrary:AgoraRtcEngineKit.plugin:preBuild UP-TO-DATE
Task :unityLibrary:AgoraRtcEngineKit.plugin:preReleaseBuild UP-TO-DATE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:preBuild UP-TO-DATE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:preReleaseBuild UP-TO-DATE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseAidl NO-SOURCE
Task :unityLibrary:packageReleaseRenderscript NO-SOURCE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:packageReleaseRenderscript NO-SOURCE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseRenderscript NO-SOURCE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseResValues UP-TO-DATE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseResources UP-TO-DATE
Task :unityLibrary:AgoraRtcEngineKit.plugin:compileReleaseAidl NO-SOURCE
Task :unityLibrary:AgoraRtcEngineKit.plugin:packageReleaseRenderscript NO-SOURCE
Task :unityLibrary:AgoraRtcEngineKit.plugin:compileReleaseRenderscript NO-SOURCE
Task :unityLibrary:AgoraRtcEngineKit.plugin:generateReleaseResValues UP-TO-DATE
Task :unityLibrary:AgoraRtcEngineKit.plugin:generateReleaseResources UP-TO-DATE
Task :unityLibrary:AgoraRtcEngineKit.plugin:packageReleaseResources UP-TO-DATE
Task :unityLibrary:generateReleaseResValues UP-TO-DATE
Task :unityLibrary:compileReleaseAidl NO-SOURCE
Task :unityLibrary:compileReleaseRenderscript NO-SOURCE
Task :unityLibrary:generateReleaseResources UP-TO-DATE
Task :unityLibrary:AgoraRtcEngineKit.plugin:extractDeepLinksRelease UP-TO-DATE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:packageReleaseResources UP-TO-DATE
Task :launcher:generateReleaseBuildConfig UP-TO-DATE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:extractDeepLinksRelease UP-TO-DATE
Task :launcher:compileReleaseAidl NO-SOURCE
Task :launcher:compileReleaseRenderscript NO-SOURCE
Task :launcher:javaPreCompileRelease UP-TO-DATE
Task :launcher:generateReleaseResValues UP-TO-DATE
Task :launcher:generateReleaseResources UP-TO-DATE
Task :launcher:createReleaseCompatibleScreenManifests UP-TO-DATE
Task :launcher:extractDeepLinksRelease UP-TO-DATE
Task :launcher:prepareLintJar UP-TO-DATE
Task :unityLibrary:AgoraRtcEngineKit.plugin:processReleaseManifest UP-TO-DATE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:processReleaseManifest UP-TO-DATE
Task :launcher:checkReleaseDuplicateClasses UP-TO-DATE
Task :launcher:desugarReleaseFileDependencies UP-TO-DATE
Task :unityLibrary:AgoraRtcEngineKit.plugin:parseReleaseLocalResources
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:parseReleaseLocalResources
Task :launcher:mergeExtDexRelease UP-TO-DATE
Task :launcher:mergeReleaseShaders UP-TO-DATE
Task :unityLibrary:packageReleaseResources
Task :launcher:compileReleaseShaders NO-SOURCE
Task :unityLibrary:AgoraRtcEngineKit.plugin:generateReleaseRFile
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseRFile
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseLibraryResources UP-TO-DATE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseBuildConfig UP-TO-DATE
Task :unityLibrary:extractDeepLinksRelease UP-TO-DATE
Task :unityLibrary:AgoraRtcEngineKit.plugin:compileReleaseLibraryResources UP-TO-DATE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:javaPreCompileRelease UP-TO-DATE
Task :unityLibrary:AgoraRtcEngineKit.plugin:generateReleaseBuildConfig UP-TO-DATE
Task :unityLibrary:AgoraRtcEngineKit.plugin:javaPreCompileRelease UP-TO-DATE
Task :unityLibrary:processReleaseManifest
Task :unityLibrary:compileReleaseLibraryResources
Task :unityLibrary:parseReleaseLocalResources
Task :unityLibrary:generateReleaseRFile
Task :unityLibrary:generateReleaseBuildConfig UP-TO-DATE
Task :unityLibrary:javaPreCompileRelease UP-TO-DATE
Task :unityLibrary:prepareLintJarForPublish UP-TO-DATE
Task :unityLibrary:mergeReleaseShaders UP-TO-DATE
Task :unityLibrary:compileReleaseShaders NO-SOURCE
Task :unityLibrary:generateReleaseAssets UP-TO-DATE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseJavaWithJavac
Task :unityLibrary:AgoraRtcEngineKit.plugin:compileReleaseJavaWithJavac
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:bundleLibCompileToJarRelease UP-TO-DATE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:prepareLintJarForPublish UP-TO-DATE
Task :unityLibrary:AgoraRtcEngineKit.plugin:bundleLibCompileToJarRelease UP-TO-DATE
Task :unityLibrary:AgoraRtcEngineKit.plugin:prepareLintJarForPublish UP-TO-DATE
Task :unityLibrary:AgoraRtcEngineKit.plugin:bundleLibRuntimeToJarRelease UP-TO-DATE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:bundleLibRuntimeToJarRelease UP-TO-DATE
Task :unityLibrary:AgoraRtcEngineKit.plugin:mergeReleaseShaders UP-TO-DATE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:mergeReleaseShaders UP-TO-DATE
Task :unityLibrary:AgoraRtcEngineKit.plugin:compileReleaseShaders NO-SOURCE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:compileReleaseShaders NO-SOURCE
Task :unityLibrary:AgoraRtcEngineKit.plugin:generateReleaseAssets UP-TO-DATE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:generateReleaseAssets UP-TO-DATE
Task :unityLibrary:AgoraRtcEngineKit.plugin:packageReleaseAssets UP-TO-DATE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:packageReleaseAssets UP-TO-DATE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:processReleaseJavaRes NO-SOURCE
Task :unityLibrary:AgoraRtcEngineKit.plugin:processReleaseJavaRes NO-SOURCE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:bundleLibResRelease NO-SOURCE
Task :unityLibrary:AgoraRtcEngineKit.plugin:bundleLibResRelease NO-SOURCE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:mergeReleaseJniLibFolders UP-TO-DATE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:mergeReleaseNativeLibs UP-TO-DATE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:stripReleaseDebugSymbols NO-SOURCE
Task :unityLibrary:GoogleMobileAdsPlugin.androidlib:copyReleaseJniLibsProjectOnly UP-TO-DATE
Task :unityLibrary:packageReleaseAssets
Task :unityLibrary:AgoraRtcEngineKit.plugin:mergeReleaseJniLibFolders UP-TO-DATE
Task :unityLibrary:AgoraRtcEngineKit.plugin:mergeReleaseNativeLibs UP-TO-DATE
Task :unityLibrary:AgoraRtcEngineKit.plugin:stripReleaseDebugSymbols UP-TO-DATE
Task :unityLibrary:AgoraRtcEngineKit.plugin:copyReleaseJniLibsProjectOnly UP-TO-DATE
Task :launcher:processReleaseManifest
Task :launcher:generateReleaseAssets UP-TO-DATE
Task :launcher:mergeReleaseAssets
Task :launcher:processReleaseJavaRes NO-SOURCE
Task :launcher:collectReleaseDependencies UP-TO-DATE
Task :launcher:sdkReleaseDependencyData UP-TO-DATE
Task :launcher:mergeReleaseJniLibFolders UP-TO-DATE
Task :launcher:validateSigningRelease UP-TO-DATE
Task :launcher:mergeReleaseResources
Task :unityLibrary:compileReleaseJavaWithJavac
Task :unityLibrary:bundleLibRuntimeToJarRelease UP-TO-DATE
Task :unityLibrary:processReleaseJavaRes UP-TO-DATE
Task :unityLibrary:bundleLibResRelease UP-TO-DATE
Task :unityLibrary:mergeReleaseJniLibFolders UP-TO-DATE
Task :unityLibrary:mergeReleaseNativeLibs UP-TO-DATE
Task :unityLibrary:stripReleaseDebugSymbols UP-TO-DATE
Task :unityLibrary:copyReleaseJniLibsProjectOnly UP-TO-DATE
Task :unityLibrary:bundleLibCompileToJarRelease
Task :launcher:processReleaseResources FAILED

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.
See Command-Line Interface
76 actionable tasks: 18 executed, 58 up-to-date
]
exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at :0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at :0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at :0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action1[T] progress, System.String error) (at :0) UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, Unity.Android.Gradle.AndroidGradle androidGradle, System.String workingdir, System.String task, System.Action1[T] progress) (at :0)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, Unity.Android.Gradle.AndroidGradle androidGradle, System.String workingdir, System.String task, System.Action`1[T] progress) (at :0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at :0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at :0)
Rethrow as BuildFailedException: Exception of type ‘UnityEditor.Build.BuildFailedException’ was thrown.
UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) (at :0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at :0)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, AndroidPlayerBuildProgram.Data.AndroidPlayerBuildProgramOutput buildProgramOutput) (at :0

Please help. :slight_smile:

‘attr/fontVariationSettings not found’., a quick google search saw me that fontvariationsettings was added in api 28, you are probably using libraries not compatible with api 27 and lower