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

Bug Dependencies try to use wrong Android SDK

Discussion in 'Android' started by Ashanex, May 16, 2023.

  1. Ashanex

    Ashanex

    Joined:
    May 2, 2019
    Posts:
    13
    Hi!
    Even though I set Unity to use android API 32 it's still trying to access API 33 because I selected it once before by accident. And when I try to build it throws me an error. And in the log I can see that there are some dependencies trying to use API 33 when 32 is installed and selected. I can't find where this dependencies are stored in order to change them.

    (Happens in both Mac and Windows, tried to deleting all folders except project setting and assets).

    Thanks for your time!
     

    Attached Files:

  2. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,817
    As per the log, the libraries you use states they need API 33 sdk. Any specific reason for not using API 33 as target api?

    As per this, better need to use API 33 (by Aug 2023) as it's requirement is not too far.
     
    aducceschi likes this.
  3. aducceschi

    aducceschi

    Joined:
    Feb 9, 2022
    Posts:
    39
    Hey, I'm Ashanex with a different account. I found the reason of the error and a half fix.
    On the Plugins > Android folder, the Android Resolver kept swapping the plugins inside with versions designed for API 33, even though I have set it to 32. The half fix that I found is to replace the files with the correct ones that I had from a project backup, and go to Assets > Mobile Dependency Resolver (Android) and set it to not update on pre-build. This way it won't change the files again.

    I can't use API 33 because the Oculus Quest Store does not allow API 33 apk yet.

    Thanks for your time!
     
  4. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,817
    Not sure what you mean by Mobile Dependency Resolver is same as EDMU or not. While the current fix might work, it may become problem once you need to resolve on new plugin additions or when your other team members try to resolve.

    However, you have a solution while keeping Target API 32. It is to specify the exact versions in dependency xml. I'm attaching you a sample but you can do the exact same way for your dependencies too.

    1. Create an Editor folder or use an existing Editor folder
    2. Place a .xml file with the expected dependencies. Let's name it CustomAndroidDependencies.xml
    3. Add contents like below.
    Code (CSharp):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <dependencies>
    3.     <androidPackages>
    4.                 <androidPackage
    5.             spec="androidx.core:core:[1.8.0]" />
    6.     </androidPackages>
    7. </dependencies>
    8.  
    I'm assuming androidx core 1.8.0 may need lesser compile sdk version. You can set that version value based on what worked for you.

    Once you set the version with in [], EDMU will resolve to that specific version and you can avoid manually fixing it everytime or for your team members.

    Note: Once oculus supports API 33 as target sdk, make sure you delete this file as EDMU will try to resolve to 1.8.0 only as you specified with in []

    Cheers,
    VB Team
     
    aducceschi likes this.
  5. aducceschi

    aducceschi

    Joined:
    Feb 9, 2022
    Posts:
    39
    Sure thanks a lot! I'll do it right now! :D