Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Failed to resolve target API for values

Discussion in 'Android' started by Newaxekub, Feb 21, 2022.

  1. Newaxekub

    Newaxekub

    Joined:
    Jan 9, 2014
    Posts:
    4
    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.

    Code (CSharp):
    1. Internal build system error. BuildProgram exited with code -2146233088.
    2. System.Exception: Failed to resolve target API for values
    3.  






     
  2. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,663
    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.
     
  3. chin13577

    chin13577

    Joined:
    May 8, 2017
    Posts:
    16
    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?
    upload_2022-3-21_14-48-54.png
     
  4. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,663
    Could you show full path where Unity is installed ?

    Also could you attach Editor.log?
     
  5. chin13577

    chin13577

    Joined:
    May 8, 2017
    Posts:
    16
    fullpath:
    C:\Program Files\Unity3D\2021.2.16f1\Editor


    this pic when I build in "Clean Build" mode.
    upload_2022-3-22_9-36-21.png
     
  6. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,663
    Could u attach editor.log?
     
  7. chin13577

    chin13577

    Joined:
    May 8, 2017
    Posts:
    16
    editor.log
     

    Attached Files:

  8. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,663
    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.
     
    Last edited: Mar 22, 2022
  9. chin13577

    chin13577

    Joined:
    May 8, 2017
    Posts:
    16
    1. yes. it is an empty project (build android)
    upload_2022-3-23_13-10-44.png
    2. English
    3. upload_2022-3-23_13-10-4.png
     

    Attached Files:

  10. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,663
    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
    Code (CSharp):
    1. int i = "values".IndexOf("-v");
    if it's zero, can you try
    Code (CSharp):
    1. int i ="values".IndexOf("-v", StringComparison.InvariantCultureIgnoreCase);
    What would is the i value in your case?
     
  11. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,663
    I think we found the cause, is by chance your Windows language is set to Thai ?
     
    teerapatsangrach and chin13577 like this.
  12. chin13577

    chin13577

    Joined:
    May 8, 2017
    Posts:
    16
    Thank you very much.

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

    tongchimlang

    Joined:
    Mar 12, 2014
    Posts:
    16
    I same problem. I've changed the Regional format to English.
    but It's not working.
     
  14. maybestudio

    maybestudio

    Joined:
    Sep 27, 2014
    Posts:
    1
    It's working