Unity & Android Manifest Interactions

I know ML2 theoretically requires API level 29, but it's getting increasingly difficult to link against modern libraries using 29. We can target Android 30/31 in Android Studio and run successfully for ML2, however Unity reverts to SDK 29 if we set SDK 30.

Can we set SDK 30+ in Unity for ML2? If so, how?

We explicitly set the SDK version to 30 in the UI:

File:Build Settings:Android:Player Settings button:Android tab:Minimum API Level:Android 11.0 (API level 30)

Similarly, Unity resets the SDK when editing the custom manifest (in Assets\Plugins\Android) to set min SDK:

<uses-sdk android:minSdkVersion="30" android:targetSdkVersion="yourTargetVersion" />

Unity combines AndroidManifest.xml files from different plugins and the main project when building the APK, and Unity's internal processes that generate and merge Android manifests are not documented.

Editing Unity's gradle template to set min and target SDK versions to 30 does not help -- the UI reverts to Android 29 even when we explicitly set:

minSdkVersion 30
targetSdkVersion 30

We’re building using the following:

  • Magic Leap SDK v1.5.0
  • Unity 2022.3.13f1
  • Android Studio 2023.1.1 Patch 1 (Hedgehog)
  • Windows 10

We follow these config notes

Hi @kevincain

Did you use this guide to create your custom manifest?

Best,

El