Cannot set Android Target to UDP

I tried to implement UDP via Unity IAP but I encountered the error: Cannot set Android target to UDP. Make sure you have installed UDP in your project
So, the sandbox login window did not pop.

I followed the steps below:
1- I enabled Unity IAP from Services and reimported the packages.
2- Selected target as UDP (Window/Unity IAP/Android/Target UDP)
3- I created game in UDP console from Editor (Window/Unity Distribution Portal/Settings)
I filled the required fields on the UDP console, added a sandbox user. Credentials are the same in editor and console.
4- Added products from Window/Unity IAP/IAP Catalog and synced with UDP
I checked the UDP console, products are there.
5- Added a script to initialize IAP, list and purchase products. (Already is working on Google Play Store)
6- I built an apk and uploaded it to App Gallery Cloud Debug for testing it on a device. ( I dont have a real device.)
7- I got the log file.
Result: Initialization of IAP is failing and sandbox login window is not showing.

Unity version : 2020.1.14f1
IAP version: 2.2.2
Manager Stripping Level: High
Custom proguard file:
-keep class com.unity.udp.**{*;}

Log:
2020-11-24 01:10:03 17917-17978/? I/Unity: UnityIAP Version: 2.2.2
UnityEngine.Purchasing.StandardPurchasingModule:Instance(AppStore)

(Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)
2020-11-24 01:10:03 17917-17978/? E/Unity: Cannot set Android target to UDP. Make sure you have installed UDP in your project
UnityEngine.Purchasing.NativeStoreProvider:GetAndroidStoreHelper(IUnityCallback, AppStore, IPurchasingBinder, IUtil)
UnityEngine.Purchasing.NativeStoreProvider:GetAndroidStore(IUnityCallback, AppStore, IPurchasingBinder, IUtil)
UnityEngine.Purchasing.StandardPurchasingModule:InstantiateUDP()
UnityEngine.Purchasing.StandardPurchasingModule:InstantiateStore()
UnityEngine.Purchasing.StandardPurchasingModule:Configure()
UnityEngine.Purchasing.PurchasingFactory:.ctor(IPurchasingModule, IPurchasingModule[ ])
UnityEngine.Purchasing.ConfigurationBuilder:Instance(IPurchasingModule, IPurchasingModule[ ])

2020-11-24 01:10:03 17917-17978/? E/Unity: NotSupportedException: Failed to bind to native store: System.NotImplementedException: The method or operation is not implemented.
at UnityEngine.Purchasing.NativeStoreProvider.GetAndroidStoreHelper (UnityEngine.Purchasing.IUnityCallback callback, UnityEngine.Purchasing.AppStore store, UnityEngine.Purchasing.Extension.IPurchasingBinder binder, Uniject.IUtil util) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.Purchasing.NativeStoreProvider.GetAndroidStore (UnityEngine.Purchasing.IUnityCallback callback, UnityEngine.Purchasing.AppStore store, UnityEngine.Purchasing.Extension.IPurchasingBinder binder, Uniject.IUtil util) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.Purchasing.StandardPurchasingModule.InstantiateUDP () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.Purchasing.StandardPurchasingModule.InstantiateStore () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.Purchasing.StandardPurchasingModule.Configure () [0x00000]

Your steps look normal. I noticed that your project is using proguard and the stripping level is high, for further investigation, could you please open a support ticket and share the APK file with us so we can take a look? Thanks.

You can open a support ticket on the UDP console. https://distribute.dashboard.unity.com/list

6555034--742270--upload_2020-11-24_14-9-47.png

Hi,
I opened a support ticket.
Test APK download link : https://we.tl/t-puanFoBxVe

Edit: UnityIAP Package Manager imported version is 2.2.1. (up to date)
I checked for updates, installed version is 2.2.2 (Window/Unity IAP/IAP Updates)
Is there a conflict?

I had the same problem. You need to install the last version of Unity Distribution Portal (2.1.0 atm) via Package Manager. I know that the documentation says that you shouldn’t have both packages installed…but you know… Unity

Thank you.

I got this error after installation of UDP 2.1.0
Build failed for same reason.

PrecompiledAssemblyException: Multiple precompiled assemblies with the same name UDP.dll included or the current platform. Only one assembly with the same name is allowed per platform. Assembly paths:
Assets/UDP/UDP.dll

Check your project files for Assets/Plugins/UDP. If there are files there, remove all of files in there except “UDP Settings.asset”.

The conflict is caused because the earlier versions of IAP used to include UDP with them and it got later removed from IAP, but the old UDP files are still there so you’ve gotta remove them yourself

Thank you.

I removed Unity IAP and UDP packages both. This time I added UDP first and then Unity IAP.
Conflict error has disappeared but the issue I reported continues:
“Cannot set Android target to UDP. Make sure you have installed UDP in your project”
Edit: The issue occurs when Managed Stripping level is set to High or Medium

That’s right. It’s because UdpIapBridge type gets stripped from UDP.dll.
Can be fixed by adding “Assets/link.xml” with this content:

<linker>
  <assembly fullname="UDP" preserve="all"/>
</linker>

See - https://docs.unity3d.com/2019.3/Documentation/Manual/ManagedCodeStripping.html

2 Likes

I have a lot of problems with the stripping set to High, why does it strips used code ?
(unfortunately I have to use High because I use a third party library that has tons of code or else it’d load my game with 10 more seconds)

Unity Distribution Portal has been deprecated. For more information, see: UDP (Unity Distribution Portal) Has Been Deprecated