android – Unity build fail because the something keeps changing “targetSdkVersion” to 25 although I already set targetSdkVersion to 26 before the build?

I am building a project in Unity 2019.4 for Android. The Unity build fails and some errors are as follows:

  /Users/ttt/.gradle/caches/transforms-2/files-2.1/7da9dc027135e74146d6626b6630ec49/res/values-v28/values-v28.xml:9:5-12:13: AAPT: error: resource android:attr/dialogCornerRadius not found.

UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:197

However, I guess that the root cause may have something to do with the targetSdkVersion in AndroidManifest.xml and

Here are what I do before running the build:

  1. Go to Build -> Player Settings -> Player -> Other Settings, and set both the Minimum API and Target API to 26.

  2. Next, I open all 6 AndroidManifest.xml file in my project, and manually set the SkdVersion as follow:

  3. Next, I open the file Temp/gradleOut/unityLibrary/project/build.gradle, and manually change the minSkdVersion and targetSdkVersion to 26.

After that, I run the build, and it fails.

Next, I look at the file build.gradle, and see that “targetSdkVersion” was incorrectly changed back to 25. Which process changed that ? This is the reason for the build to fail ?

I can also see that, in 2 out of 6 AndroidManifest.xml files, the parameter “targetSkdVersion” was incorrectly reset to 25 while the other 4 AndroidManifest.xml files still have the correct version “targetSkdVersion = 26“. Would anyone please tell me which process changed this parameter ? I guess this is also the same reason that causes the build to fail.