Search Unity

Bug Build fails, Unable to install additional SDK platform

Discussion in 'Unity Build Automation' started by ooxcit, Mar 10, 2023.

  1. ooxcit

    ooxcit

    Joined:
    Jul 7, 2021
    Posts:
    26
    Unity 2020.3.19

    I tried building clean build with sdk 30, 31, 33 but always same result.


    EXCEPTION: CommandInvokationFailure: Unable to install additional SDK platform. Please run the SDK Manager manually to make sure you have the latest set of tools and the required platforms installed.
    [2023-03-10T10:23:20Z - Unity] /UNITY_PATH/Unity/android/sdk_30_0_2/cmdline-tools/latest/bin/sdkmanager "platforms;android-33"
    [2023-03-10T10:23:20Z - Unity]
    [2023-03-10T10:23:20Z - Unity] stderr[
    [2023-03-10T10:23:20Z - Unity] Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
    [warning] [2023-03-10T10:23:20Z - Unity] Warning: Failed to read or create install properties file.
    [2023-03-10T10:23:20Z - Unity] ]
    [2023-03-10T10:23:20Z - Unity] stdout[
    [2023-03-10T10:23:20Z - Unity] Loading package information...
    [2023-03-10T10:23:20Z - Unity] Loading local repository...
    [2023-03-10T10:23:20Z - Unity] [ ] 3% Loading local repository...
    [2023-03-10T10:23:20Z - Unity] [ ] 3% Fetch remote repository...
    [2023-03-10T10:23:20Z - Unity] [= ] 3% Fetch remote repository...
    [2023-03-10T10:23:20Z - Unity] [= ] 4% Fetch remote repository...
    [2023-03-10T10:23:20Z - Unity] [= ] 5% Fetch remote repository...
    [2023-03-10T10:23:20Z - Unity] [== ] 5% Fetch remote repository...
    [2023-03-10T10:23:20Z - Unity] [== ] 6% Fetch remote repository...
    [2023-03-10T10:23:20Z - Unity] [== ] 7% Fetch remote repository...
    [2023-03-10T10:23:20Z - Unity] [=== ] 8% Fetch remote repository...
    [2023-03-10T10:23:20Z - Unity] [=== ] 8% Computing updates...
    [2023-03-10T10:23:20Z - Unity] [=== ] 10% Computing updates...
    [2023-03-10T10:23:20Z - Unity] [=== ] 10% Installing Android SDK Platform 33
    [2023-03-10T10:23:20Z - Unity]
    [2023-03-10T10:23:20Z - Unity] [=== ] 10% Installing Android SDK Platform 33
    [2023-03-10T10:23:20Z - Unity] ]
    [2023-03-10T10:23:20Z - Unity] exit code: 1
     
  2. ooxcit

    ooxcit

    Joined:
    Jul 7, 2021
    Posts:
    26
    Fixed it with changing builder operating system from Mac to Windows.
     
  3. Benjamin-Gooding

    Benjamin-Gooding

    Unity Technologies

    Joined:
    Apr 12, 2022
    Posts:
    303
    In your target configuration, did you select Android SDK 33 from the drop down?
     
  4. ooxcit

    ooxcit

    Joined:
    Jul 7, 2021
    Posts:
    26
    It is set to Default
     
  5. Benjamin-Gooding

    Benjamin-Gooding

    Unity Technologies

    Joined:
    Apr 12, 2022
    Posts:
    303
    Update the build target configuration and change it to Android SDK 33. Try the build again.
     
  6. henriqueranj

    henriqueranj

    Joined:
    Feb 18, 2016
    Posts:
    177
    @benjamingooding How does the UCB Build Target Android SDK Version setting interact with the Player Settings Target SDK setting? By setting it to "Default" does it use what comes from the Player Settings?

    In my current environment I have the following:
    1. The project is using Unity 2021.3.18f1
    2. The project's Player Settings is explicitly configured for Target API Level to 33.
    3. The UCB Build Targets for this project have the Android SDK Version to "Default"
    4. The resulting APKs from the builds show that they are targeting API Level 33 (inspected via `aapt2 dump badging`)
     
  7. ooxcit

    ooxcit

    Joined:
    Jul 7, 2021
    Posts:
    26
    Doesn't work on mac build platform, only windows
     
    henriqueranj likes this.
  8. Benjamin-Gooding

    Benjamin-Gooding

    Unity Technologies

    Joined:
    Apr 12, 2022
    Posts:
    303
    Setting it to Default will use the default version for the Unity version specified, which for 2021.3 is SDK 30. We use the value selected to point to the appropriate SDK installation when running the builds.
     
  9. henriqueranj

    henriqueranj

    Joined:
    Feb 18, 2016
    Posts:
    177
    Thank you for the response. However, I might still be confused over the terminology and the interaction between these settings. Am I misunderstanding the semantics between the settings:
    - "Target Level API" in the Unity Editor Player Settings
    - "Android SDK Version" in the UCB Build Target Platform specific settings (Android)

    Are these the same thing? If so, does the "Android SDK Version" from UCB override whatever is set in the Player Settings?

    As I mentioned in my previous post, with the UCB Build Target's Android SDK Version set to "Default", the resulting APKs and AABs are targeting Android API Level 33 (proved by both the `aapt2` command and the PlayStore Console).
     
  10. Benjamin-Gooding

    Benjamin-Gooding

    Unity Technologies

    Joined:
    Apr 12, 2022
    Posts:
    303
    They are not the same thing. We do not override the target level api that you set in your project.

    In Unity Build Automation, the Android SDK Version is used to provide the SDK installation required for building your target. When you select Default, we use the default supported SDK for a Unity version which is SDK 30 for all the Unity Versions we support except for Unity 2022.2 which requires SDK 32 and up.

    Ideally, you should configure the build target in UBA to use the same Android SDK version that you are targeting.
     
    henriqueranj likes this.