question

trey-vz avatar image
trey-vz asked

Missing PlayFab assembly reference.

I am currently getting this error "ssets/Scripts/UniPushScript.cs(2,15): error CS0234: The type or namespace name `Android' does not exist in the namespace `PlayFab'. Are you missing an assembly reference?"


I have followed the setup instructions in PlayFab's tutorial to the letter, and even started from a fresh project 3 times, and I'm still getting this error.

I am using Unit 5.5
I have the current PlayFab SDK.
I have the current Android Push Plugin.
I have linked my Google Play server key to my PlayFab.

I have imported:
UnitySDK.unitypackage
PlayfabEditorExtensions.unitypackage
AndroidPushPlugin.unity package

I did not deselect any of the imported assets, and I have not altered the assets in any way.

I created a "UniPushScript" and copied the code directly from the tutorial manual.

I have no idea why this is happening.

unity3dsdksandroid
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

Can you confirm that you followed these instructions in setting up the push plugin source in yoru project? https://github.com/PlayFab/UnitySDK/tree/master/AndroidPluginSrc/PushSrc_10.0.1

The push plugin is where the Android namespace is defined in the PlayFab namespace, so the plugin must be loaded into your project as described for that to be found.

9 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

trey-vz avatar image trey-vz commented ·

Yes I can verify that I did. I actually even stated that in my initial question.

0 Likes 0 ·
brendan avatar image brendan trey-vz commented ·

Yes, I saw that you were saying you followed the tutorial, but we do have several so I wanted to confirm the specifics. That error message literally is saying that the namespace in question (PlayFab.Android) doesn't exist. Literally the only way that is possible is if the package that contains the namespace in question isn't found in your project on load. So specifically: Which package file are you using, and where is it in your project?

0 Likes 0 ·
trey-vz avatar image trey-vz brendan commented ·

Perhaps I need to clarify. I know what the error means, I'm new to PlayFab, not to Unity. I'm very well versed in Unity.

The issue isn't what the error means, it's that the package isn't there when I know it should be.

From a clean project each time using these files:
UnitySDK.unitypackage
PlayFabEditorExstension.unitypackage
AndroidPushPlugin.unitypackage


I have done manual asset installs in Unity (assets>import package>custom package).

I have opened all three .unitypackages while my project was open.

I have used the PlayFab editor's "Import SDK" and "Push Notification Plugin" buttons to import the latest version from PlayFab directly.

Unfortunately, all three have had equally unfruitful results :/

I know it's best to find out what has and has not been done, so hopefully this helps. Thank you for your help thus far.

0 Likes 0 ·
Show more comments
trey-vz avatar image trey-vz commented ·

[SOLVED] Ok, so I managed to find the issue, and it was unnecessarily complicated.

The real issue:
The AndroidPushPlugin.unitypackage was not decompressing properly (which is actually a separate question I posted).

The source of the problem:
Unity 5.x was the issue. More specifically the 7zip dlls. Unity 5.x for whatever reason, does not use the most stable .dlls for 7zip, so I had to manually remove them from (Programs>Unity>Editor>Data>tools) and replace them with the original .dlls from the actual 7zip root.

After that, I then had to close Unity, restart my computer, and start from the last stable build of the project without PlayFab.

I was then able to import everything properly and the "missing assembly reference" error went away. However, this then lead to a dex format repackaging error. The solution for this was pretty easy to find. This is running concurrent with the Facebook SDK, and so the source of that problem was the appcompat-v7-x.x.x.aar being a duplicate library.

Now, it builds, runs, and sends push notifications.

0 Likes 0 ·
brendan avatar image brendan trey-vz commented ·

Thanks, that's extremely useful info. I'll ask the tools team to review and see what they can do to help prevent this.

0 Likes 0 ·
trey-vz avatar image trey-vz brendan commented ·

Sorry for necro-posting this, but I think it may be relevant.
Something broke in the build and I had to re-install the PlayFab plugins, which lead to a new dex format compiler error. I suspected this was due to an outdated AndroidPushPlugin, as it was the source of the error, so I unistalled it, and tried to download it through the PlayFab editor. That then resulted in the "Failed to import package" error again, which didn't make any sense since it was working last week. Then I found what I think the problem is.

The link to the Push Plugin on this page "https://api.playfab.com/docs/tutorials/landing-players/push-notification-basics/push-notifications-for-android" is a dead link.
I suspect that the PlayFab editor uses the same link to install the plugin, which means it's calling a dead link, which would 100% cause the error because there is no package to import.

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.