简体   繁体   English

添加Firebase时,Unity项目无法在VS2015中编译

[英]Unity project does not compile in VS2015 when adding Firebase

I'm having troubles integrating Firebase for Unity in my project. 我在项目中集成Firebase for Unity时遇到了麻烦。 As soon as I add it, it seems to work fine in Unity but the C# project does not compile anymore in VisualStudio 2015 一旦我添加它,它似乎在Unity中工作正常,但C#项目在VisualStudio 2015中不再编译

I'm having a lot of warnings looking like : 我有很多警告看起来像:

>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1820,5):
warning MSB3258: The primary reference "Firebase.App" could not be resolved because it has  
an indirect dependency on the .NET Framework assembly "System, Version=4.0.0.0,  
Culture=neutral, PublicKeyToken=b77a5c561934e089" which has a higher version "4.0.0.0"  
than the version"2.0.0.0" in the current target framework.

Which, I assume are problematic because after a douzain of those on different classes from Google Firebase sdk for Unity I get : 其中,我认为是有问题的,因为在针对Unity的Google Firebase sdk的不同类别的人员之后,我获得了:

[Edited Path of my project]\Assets\Firebase\Editor\AnalyticsDeps.cs(30,36,30,42): 
error CS0103: The name 'Google' does not exist in the current context

在此输入图像描述

It seems that when building a version for Android, everything is fine but calls to LogEvent are not executed. 似乎在为Android构建版本时,一切都很好但是没有执行对LogEvent调用。 Plus, with this problem I can no longer debug the scripts as they do not compile in VS. 另外,有了这个问题,我无法再调试脚本,因为它们不能在VS中编译。

Looks like it's .NET framework problem, but I have no idea how to solve this. 看起来它是.NET框架问题,但我不知道如何解决这个问题。 I do not have latest version of Unity as I'm releasing very soon and I kept the last stable version (5.3.5f1) for my game (further versions made my game enter infinite loops) 我没有最新版本的Unity,因为我很快就会发布,我为我的游戏保留了最后一个稳定版本(5.3.5f1) (更多版本让我的游戏进入无限循环)

[Edit] Here are the steps I used to reproduce the problem with a new Unity project having only one (default generated) script file: [编辑]以下是我用一个新的Unity项目重现问题的步骤,该项目只有一个(默认生成的)脚本文件:

Steps: 脚步:

  1. Have unity VS install so scripts are edited in Visual Studio 2015 拥有统一VS安装,以便在Visual Studio 2015中编辑脚本
  2. Open existing project or create a new one in Unity with at least one script in the project 打开现有项目或在Unity中创建一个新项目,项目中至少有一个脚本
  3. Add the .json for the app generated from the Google Developer console 为从Google Developer Console生成的应用添加.json
  4. Import FirebaseAnalytics.unitypackage into projects 将FirebaseAnalytics.unitypackage导入项目
  5. Wait for all the unitypackage to process 等待所有unitypackage处理
  6. Switch build setting to android if you're not already on Android platform 如果你还没有在Android平台上,请将构建设置切换到android
  7. Assets -> Open C# project 资产 - >打开C#项目
  8. Compile in VS 在VS中编译
  9. See all the MS Build warnings and following the error about google not being found 查看所有MS Build警告并跟踪有关未找到Google的错误

And here are the configs I tried it on : 以下是我试过的配置:

Configuration : windows 7 home premium SP1 64bits with: 配置: windows 7家庭高级版SP1 64位带:

  • VS 2015 community Version 14.0.25425.01 Update 3 VS 2015社区版本14.0.25425.01更新3
  • Unity Version 5.3.5f1 (960ebf59018a) Personal Unity版本5.3.5f1(960ebf59018a)个人
  • Android SDK Tools 25.2.3 Android SDK工具25.2.3
  • Android SDK Plateform-Tools 25.0.1 Android SDK Plateform-Tools 25.0.1
  • Android SDK Build-Tools 25.0.1 Android SDK Build-Tools 25.0.1
  • NDK 10 NDK 10
  • JDK 8u111x64 JDK 8u111x64
  • Firebase for Unity 1.0.1 适用于Unity 1.0.1的Firebase

I also did a clean install on another PC with latest Unity and VS 2015 and SDK/JDK/NDK etc. setup on a Windows 8.1 home edition with the same result. 我还在另一台PC上进行了全新安装,在Windows 8.1家庭版上安装了最新的Unity和VS 2015以及SDK / JDK / NDK等,结果相同。 [/Edit] [/编辑]

Looks like a known issue, here is an answer from google support : 看起来像一个已知问题,这是谷歌支持的答案:

Hi Chris, 嗨克里斯,

Thanks for sending all these details. 感谢您发送所有这些细节。

This is a legit issue and we are tracking this internally. 这是一个合法的问题,我们正在内部跟踪这个问题。

However, won't be able to commit about the ETA and timelines for this issue to get resolved. 但是,无法提交有关此问题的ETA和时间表以解决问题。

In the meantime, the engineer of concerned team have suggested workaround to build in Unity (which you already did successfully) and go ahead with the release. 与此同时,相关团队的工程师建议在Unity中构建解决方法(您已经成功完成)并继续发布。

Regards, 问候,

Update: 更新:

Hello Chris, 你好克里斯,

Thanks for all the inputs and feedback to drive this bug to resolution. 感谢所有输入和反馈,以驱动此错误解决。

We have fixed this bug in our Unity plugin. 我们在Unity插件中修复了这个错误。

This will be released and pushed soon to production. 这将被发布并很快投入生产。 Keep an eye on our release notes . 请留意我们的发行说明

Feel free to reach out if you have any further questions. 如果您有任何其他问题,请随时与我们联系。

Regards, 问候,

Update 2 Fixed in version 1.1.0 of Firebase 更新2已在Firebase 1.1.0版中修复

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM