Unity Technologies

Typically, the cause of this issue is not running the API Updater when installing Unity IAP.

In 2017.x , the VR namespace was changed to XR. Unity has an API Updater that should fix all references to changed APIs. When you install a package with an old API reference, you should be prompted to run the API Updater (and make a backup of your project first). This is required for IAP to function correctly on Android because we support In-App purchases for Google Daydream.

I'm not sure if you'll need to enable Virtual Reality Support. That may be something worth trying if running the API Updater doesn't resolve this issue.

We also have heard some reports of issues with IL2CPP and .NET 4.6; however, that is usually a build issue, not a runtime problem, so I don't think it is related. However, if you are using .NET 4.6, it may be something to consider.

I did run the API updater as I saw on another thread that it can solve similar issues. I also tried completely deleting unity IAP and reinstalling it from scratch to make sure I didn't have any older Unity IAP version's stuff laying around. When reinstalling I made sure that the project had no compile errors before importing Unity IAP and running the API updater.

If the namespace has changed then I don't see how enabling VR would solve the issue as the namespace would still be XR would it not?

Yes, if there are any compile errors prior to updating/reimporting Unity IAP, the API updater may fail.

Click to expand...

This limitation is kind of annoying from a usability standpoint. Is there anyway to get Unity to only compile the editor scripts to run the updater? Or does it rely on reflection and other things that need all code compiled before running, if that's the case then does it fail to convert code in #def tags that are not active? For example if I import the new unity IAB when on iOS would my and any plugins' #UNITY_ANDROID code fail to update correctly?

I'm in the same boat on this issue. I've tried this last suggestion of importing the IAP package into a fresh project and allowing the API updater to run, then replace the UnityPurchasing and UnityChannel folders in my main project but I still get this runtime error:

Unity Technologies

@jason_yak These are exceptions on the device after you pushed a new build after the IAP import? Can you confirm that you got the API updater prompt, asking to make sure you have a backup? Also, not sure what you mean by "replace", this should be handled by the update. Did you perform any additional manual steps?

@JeffDUnity3D I'd followed the previous suggestion where someone had suggested to import the IAP classes into a new project allowing the API updater to run, and then copying and replacing the updated plugin files into my main project. However you might be able to confirm for me if this is a false move or not. But if not, then yes I ran the API updater over the imported package, I was prompted to run it after importing.

note: I don't want to run the API updater unnecessarily over my entire project because it's a very huge and complex project, I have no idea what else it will do to my third party DLL's and what behavioural changes it might cause. I never run the API updater on it because I prefer to fix any API code errors myself so I know what's being changed. I don't quite understand why I even need the API updater at all... will this namespace mix up be fixed in an IAP class update? this is the thing I hate about DLL's and compiled source, I have no control over the code and things inevitably become outdated usually with no course of action available to a programmer but to wait for someone else to maybe fix it.

Unity Technologies

There should be no need for additional manual steps after the update. Make a back up of your project first, then allow the API updater to run and make sure you see the dialog prompt that mentions having a back up first.

I'm not sure if you're following me, I have a very large project with dozens of plugins, some very old. To have quality control I can not run the API updater on my main project. It's not a viable option for me because I don't know what kinds of issues it will cause. Under normal circumstances I understand I shouldn't 'need' to do extra manual steps.... I'm saying that I don't have a choice, because I can't run the API updater on my main project. Can you verify if I were to:
- create empty project
- import IAP classes
- run API updater
- copy and paste these plugin files from this new project to my existing project

Would you expect the files to be updated to use the XR namespace? because this seems to be my only option, and it's not working. I still get the error as described in my first message.

Unity Technologies

Please follow my directions. Make a back of your entire project first so that it is safe to run the API updater. Otherwise, we cannot guarantee results. I would not expect your steps to work. Your last step would cause it to fail. Instead, on that last step, import your other project plugins (one at a time to ensure it compiles) but leave the UnityPurchasing and UnityChannel folders intact. But that is the long way, a better way is my original description.

Ok thanks for confirming that the copy and paste would not work. I use version control so I'll just run the API updater allowing it to change whatever it changes, and then revert all changes other than the IAP plugin files. That should get best of both worlds. It would take me a week to confirm that the API updater wasn't creating bugs in other plugins for every platform and build variant we support otherwise.

Unity Technologies

My suggestion would at least allow you to compile and deploy your app in a matter of hours. Granted there may be run time issues later on, but it would be a good first step, perhaps in parallel with your plan.

Same problem in Unity 2018.2.17f1. Five times I deleted and reinstalled an IAP plugin (last version 1.20.1), but it doesn't work. VR is nowhere used and not enabled, it's a google play application.
How can I solve this?

I made all steps from link, but question "Update API, Did you make a backup?" didn't appear. Before that was installed IAP 1.18, Unity version 2017 (not sure), IAP used first time in this project. In new blank project i don't try.

Unity Technologies

@Friend123 Then you have a wider issue. Can you reproduce on another computer? Are you creating your projects under C:\Users\[username]\Documents as a test to make sure it is not a permission issue? Any other differences in your system that we should be aware of? I just tested 2018.2.17f1 and got the API Update Required dialog as expected, with the "I made a backup, Go Ahead" button that I then clicked.

@Friend123 Then you have a wider issue. Can you reproduce on another computer? Are you creating your projects under C:\Users\[username]\Documents as a test to make sure it is not a permission issue? Any other differences in your system that we should be aware of? I just tested 2018.2.17f1 and got the API Update Required dialog as expected, with the "I made a backup, Go Ahead" button that I then clicked.

Click to expand...

I've tried on my second computer (windows 7 x64, administration privilegies, both - first and second), i've installed clean last Unity 2018.2.18f1, but there is same situation - no dialog.
Why this dialog so important - there is talk about obsolete functions?

Unity Technologies

IAP works in VR too, so is supported. So you've tried on two separate computers, same behavior. We have not heard of reports of anyone else with this issue. Can you think of any differences that might be relevant? How are you installing IAP? Is this US-English Windows?

IAP works in VR too, so is supported. So you've tried on two separate computers, same behavior. We have not heard of reports of anyone else with this issue. Can you think of any differences that might be relevant? How are you installing IAP? Is this US-English Windows?

Click to expand...

This is not my project, but I asked the owner to reinstall the IAP. He reinstalled, dialog has been show and IAP did not give an error (he also has windows 7 and the latest version of Unity). The only difference is that he reinstalled with his project keys.
But, logically, in my empty project it should have worked.

GOT SOLUTION For 2019 users:
I tried this with Unity2019.1.0f2 and the "Update API, Did you make a backup?" popup didn't appear.

Tried creating a new project with Unity2018.3.10f1 in Documents folder and the "Update API, Did you make a backup?" popup appeared. I then took the UDP, UnityChannel, and UnityPurchasing folder and pasted it in my 2019 project.
Before pasting the updated folders delete the existing 3 folders from your 2019 project. I built and ran it on my device and it worked.

One thing i noticed is after building and running it on my device without publishing the apk on google play console. The IAP popup still appeared and i was able to make a test purchase. So if you wana test it just do a build and run onto your device but make sure you set up the testers accounts under account settings and alpha testers accounts under alpha release in google play console. oh and of course make sure you setup the in app products. number of products used in unity should be same as number of products added to google play console otherwise Unity IAP won't initialize properly and the button won't work.

EDIT: I Mean Create a new project with Unity2018.3.10f1 enable IAP and Import files then you should get the popup.

GOT SOLUTION For 2019 users:
I tried this with Unity2019.1.0f2 and the "Update API, Did you make a backup?" popup didn't appear.

Tried creating a new project with Unity2018.3.10f1 in Documents folder and the "Update API, Did you make a backup?" popup appeared. I then took the UDP, UnityChannel, and UnityPurchasing folder and pasted it in my 2019 project.
Before pasting the updated folders delete the existing 3 folders from your 2019 project. I built and ran it on my device and it worked.

One thing i noticed is after building and running it on my device without publishing the apk on google play console. The IAP popup still appeared and i was able to make a test purchase. So if you wana test it just do a build and run onto your device but make sure you set up the testers accounts under account settings and alpha testers accounts under alpha release in google play console. oh and of course make sure you setup the in app products. number of products used in unity should be same as number of products added to google play console otherwise Unity IAP won't initialize properly and the button won't work.

EDIT: I Mean Create a new project with Unity2018.3.10f1 enable IAP and Import files then you should get the popup.

GOT SOLUTION For 2019 users:
I tried this with Unity2019.1.0f2 and the "Update API, Did you make a backup?" popup didn't appear.

Tried creating a new project with Unity2018.3.10f1 in Documents folder and the "Update API, Did you make a backup?" popup appeared. I then took the UDP, UnityChannel, and UnityPurchasing folder and pasted it in my 2019 project.
Before pasting the updated folders delete the existing 3 folders from your 2019 project. I built and ran it on my device and it worked.

One thing i noticed is after building and running it on my device without publishing the apk on google play console. The IAP popup still appeared and i was able to make a test purchase. So if you wana test it just do a build and run onto your device but make sure you set up the testers accounts under account settings and alpha testers accounts under alpha release in google play console. oh and of course make sure you setup the in app products. number of products used in unity should be same as number of products added to google play console otherwise Unity IAP won't initialize properly and the button won't work.

EDIT: I Mean Create a new project with Unity2018.3.10f1 enable IAP and Import files then you should get the popup.

Cheers

Click to expand...

Interesting, I used the 2019.1 build and my project was in 2019.2. I will try this way and report back. Didn't even think about doing it this way but wow might be helpful! Thanks!

Can you do me a favor? Create a small repo project and file a bug (and share the bug id) ? If possible include also Unity.log when you open the project in 2018.3 (and it worked).

Click to expand...

He dosnt open the project from 2019 to 2018. He creates an entirely new project from 2018 and takes those iap import files and copies them into the existing 2019 project. Yall dropped the ball on this one just a little. Hopefully no one imports iap into a 2019 it's broken.

Oops...

"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.