We’ve just recently enabled code stripping in our game and we’ve hit a problem with the Addressables package. ProviderOperation is being stripped due to the use of reflection.
MissingMethodException : Default constructor not found for type UnityEngine.ResourceManagement.AsyncOperations.ProviderOperation`1[[UnityEngine.AddressableAssets.Initialization.ResourceManagerRuntimeData, Unity.Addressables, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]
System.RuntimeType.CreateInstanceMono
I don’t believe we can use link.xml as a way to fix the problem due to the use of generics
Been having the exact error message on ios at run time yesterday. But found out we were missing the Addressable Packages for the build, so put the AddressableAssetSettings.CleanPlayerContent and then AddressableAssetSettings.BuildPlayerContent in the build process before buildplayer, and it works on device. [for the assets setup within static assets packs]
We currently have the same issue in our project here.
I really think it’s a bug due to the 0.8.6 rollback that fix the issue.
MissingMethodException: Default constructor not found for type UnityEngine.ResourceManagement.AsyncOperations.ProviderOperation`1[[UnityEngine.AddressableAssets.Initialization.ResourceManagerRuntimeData, Unity.Addressables, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]
at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic) [0x0007b] in <71d402037f2643fe94cabbbe0d22d04d>:0
at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00009] in <71d402037f2643fe94cabbbe0d22d04d>:0
at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Threading.StackCrawlMark& stackMark) [0x00027] in <71d402037f2643fe94cabbbe0d22d04d>:0
at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00020] in <71d402037f2643fe94cabbbe0d22d04d>:0
at System.Activator.CreateInstance (System.Type type) [0x00000] in <71d402037f2643fe94cabbbe0d22d04d>:0
at UnityEngine.ResourceManagement.Util.LRUCacheAllocationStrategy.New (System.Type type, System.Int32 typeHash) [0x00055] in D:\Project\Designer\Designer\Library\PackageCache\com.unity.addressables@1.1.9\Runtime\ResourceManager\Util\ResourceManagerConfig.cs:134
at UnityEngine.ResourceManagement.ResourceManager.CreateOperation[T] (System.Type actualType, System.Int32 typeHash, System.Int32 operationHash, System.Action`1[T] onDestroyAction) [0x00032] in D:\Project\Designer\Designer\Library\PackageCache\com.unity.addressables@1.1.9\Runtime\ResourceManager\ResourceManager.cs:358
at UnityEngine.ResourceManagement.ResourceManager.ProvideResource (UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation location, System.Type desiredType) [0x000d1] in D:\Project\Designer\Designer\Library\PackageCache\com.unity.addressables@1.1.9\Runtime\ResourceManager\ResourceManager.cs:260
at UnityEngine.ResourceManagement.ResourceManager.ProvideResource[TObject] (UnityEngine.ResourceManagement.ResourceLocations.IResourceLocation location) [0x00001] in D:\Project\Designer\Designer\Library\PackageCache\com.unity.addressables@1.1.9\Runtime\ResourceManager\ResourceManager.cs:287
at UnityEngine.AddressableAssets.Initialization.InitializationOperation.CreateInitializationOperation (UnityEngine.AddressableAssets.AddressablesImpl aa, System.String playerSettingsLocation, System.String providerSuffix) [0x0009a] in D:\Project\Designer\Designer\Library\PackageCache\com.unity.addressables@1.1.9\Runtime\Initialization\InitializationOperation.cs:42
at UnityEngine.AddressableAssets.AddressablesImpl.InitializeAsync (System.String runtimeDataPath, System.String providerSuffix) [0x0008d] in D:\Project\Designer\Designer\Library\PackageCache\com.unity.addressables@1.1.9\Runtime\AddressablesImpl.cs:280
at UnityEngine.AddressableAssets.AddressablesImpl.InitializeAsync () [0x00013] in D:\Project\Designer\Designer\Library\PackageCache\com.unity.addressables@1.1.9\Runtime\AddressablesImpl.cs:289
at UnityEngine.AddressableAssets.AddressablesImpl.get_InitializationOperation () [0x00013] in D:\Project\Designer\Designer\Library\PackageCache\com.unity.addressables@1.1.9\Runtime\AddressablesImpl.cs:306
at UnityEngine.AddressableAssets.AddressablesImpl.LoadContentCatalogAsync (System.String catalogPath, System.String providerSuffix) [0x0004c] in D:\Project\Designer\Designer\Library\PackageCache\com.unity.addressables@1.1.9\Runtime\AddressablesImpl.cs:296
at UnityEngine.AddressableAssets.Addressables.LoadContentCatalogAsync (System.String catalogPath, System.String providerSuffix) [0x00001] in D:\Project\Designer\Designer\Library\PackageCache\com.unity.addressables@1.1.9\Runtime\Addressables.cs:231
at Ubiant.Common.Adressables.AddressablesLoader+<InitializeAddressables>d__2.MoveNext () [0x00020] in D:\Project\Designer\Designer\Assets\Scripts\Runtime\Addressables\AddressablesLoader.cs:49
at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00027] in <1cc3984764e64bdeb5a66b5d2a3bc7e1>:0
UnityEngine.MonoBehaviour:StartCoroutineManaged2(IEnumerator)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
Ubiant.Designer.Managers.ApplicationManager:Awake() (at D:\Project\Designer\Designer\Assets\Scripts\Runtime\Misc\ApplicationManager.cs:48)
We currently use the addressables package in a project where no addressables are built. So for me it’s pointless to call the Clean / Build process step in PreBuild phase just to hook the compiler and tell him “Hello, addressables are here please don’t strip them in my runtime build”.
By the way, it’s not linked to IL2CPP but just to the fact that we activated the stripping process into PlayerSettings.
Any idea on this particular problem ?
I bring another precision on the solution found in the above post.
For us here the Clean/Build player content solution doesn’t work at all.
link.xml couldn’t be used due to the non IL2CPP target (standalone build) it’s not used on mono backend.
Disabled stripping works but it’s not a really good workaround
If you have any solution that could allow us to maintain the stripping and avoid this issue it could be cool
Is it not? As far as I am aware it’s part of UnityLinker, which I thought was used for both Mono and IL2CPP builds.
Edit: Reading the docs, it quite explicitly states that it is used for all builds, the differences in its behaviour between IL2CPP and Mono are outlined in some detail.
Could you go into more details on how to add these to the build process? This issue is really frustrating for me and makes me wish I hadn’t tried using Addressables. I don’t even have the option to roll back that far.
I built in Addressables Menus (Window → Asset Management → Addressables → Groups. Then Build → New Build → Default Build Script from the top bar), and it worked in Run-Time.
Hello!
Could you describe a bit more the process? Where did you put AddressableAssetSettings.CleanPlayerContent and AddressableAssetSettings.BuildPlayerContent ?
I have this error since yesterday!
I just add the same problem after switching platform to Android and trying to build right away.
I got rid of the error by updating the addressables build and then trying to build the APK again.