Failed to resolve target API for values

I am trying to build android in version 2021.2.++ and found this problem

Previously I was using Unity 2021.1.19f1 can build.

I’ve been trying to find information. But there is no solution to this problem.
I don’t know why, as soon as I switched to version 2021.1.++ the problem disappeared.

Internal build system error. BuildProgram exited with code -2146233088.
System.Exception: Failed to resolve target API for values

In 2021.2, Android switched to incremental build pipeline, seems there’s some kind of bug. Could you do a search for styles.xml file in <unity_install_path>Editor\Data\PlaybackEngines\AndroidPlayer\Apk\res\ and show in what folders those files are located.

Alternatively, in Build button dropdown, there’s Clean option, try using it.

I’ve tried the “Clean build” option and it’s not working. any solution?

and there are “styles.xml” here. how should I fix it?
7980528--1024593--upload_2022-3-21_14-48-54.png

Could you show full path where Unity is installed ?

Also could you attach Editor.log?

fullpath: C:\Program Files\Unity3D\2021.2.16f1\Editor

this pic when I build in “Clean Build” mode.

Could u attach editor.log?

editor.log

7983351–1025373–EditorLog.txt (186 KB)

Hmph, I can’t seem to reproduce this issue.

  • Does this happen with empty project?

  • What’s your Windows Display Language? wondering if it’s related to culture specific strings

  • Could you do this:

  • Open windows console (Windows Key + R, cmd)

  • Navigate to C:\Program Files\Unity3D\2021.2.16f1\Editor\Data\PlaybackEngines\AndroidPlayer\Apk

  • And enter dir /S /B /A:-D

  • This will print all files in the subdirectories and might give a hint what’s going on.

  1. yes. it is an empty project (build android)
  2. English
    3.

I asked few people internally, and it’s very puzzling how can that failure occur for u.

Could you do this:

  • Open Visual Studio
  • Create C# project
  • Write this code
int i = "values".IndexOf("-v");

if it’s zero, can you try

int i ="values".IndexOf("-v", StringComparison.InvariantCultureIgnoreCase);

What would is the i value in your case?

I think we found the cause, is by chance your Windows language is set to Thai ?

2 Likes

Thank you very much.

as you said. I’ve changed the Regional format to English. and it’s work!
7986969--1026105--upload_2022-3-23_17-21-23.png

4 Likes

I same problem. I’ve changed the Regional format to English.
but It’s not working.

It’s working