Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Resource error #553

Open
sognatore99 opened this issue Nov 14, 2019 · 6 comments
Open

Android Resource error #553

sognatore99 opened this issue Nov 14, 2019 · 6 comments
Labels
bug Something isn't working platform-Android

Comments

@sognatore99
Copy link

Xenko Version 3.1.0.1
Using Physics Sample and opening in Visual Studio 2019 Xamarin. When I compile (either Debug or Release) for Android I am receiving this error:

Severity Code Description Project File Line Suppression State Suppression State
Error CS0433 The type 'Resource' exists in both 'Xenko.Engine, Version=3.1.0.1, Culture=neutral, PublicKeyToken=null' and 'Xenko, Version=3.1.0.1, Culture=neutral, PublicKeyToken=null' PhysicsSample.Android C:\Users\xxxx\Documents\Xenko Projects\PhysicsSample\PhysicsSample.Android\Resources\Resource.Designer.cs 29 Active

I am using Visual Studio 2019 Version 16.3.8. I have read that VS 2019 has some issue with resources but I could not load the solution produced in VS 2017 as I get a waring that "the solution is higher than the solution version supported"

Any help would be appreciated. I have done the standard clean, rebuild, restart VS2019, reboot computer, screamed loudly :) etc.

Thanks

@sognatore99 sognatore99 added the bug Something isn't working label Nov 14, 2019
@WernhervonBraun
Copy link

I have this error on any Android project. Even empty.

@RodrigoMedeirosRS
Copy link

RodrigoMedeirosRS commented Dec 28, 2019

Any workaround to this error? Same problem here.

@RodrigoMedeirosRS
Copy link

Error

@yangguosdxl
Copy link
Contributor

This Error is caused by auto generate Resource.Designer.cs.

Xenko.Engine.csproj's RootNamespace is Xenko, so it's namespace is Xenko in generated Resource.Designer.cs. this namespace is the same as Xenko.csproj's Resource.Designer.cs

I change the RootNamespace property to Xenko.Engine in project Xenko.Engine, it generate the Resource class to Xenko.Engine. This fix the namesapce conflict error. but cause another error
“d:\home\workspace\test\XenkoSrc\build\xenko.build”(BuildAndroidXenkoEngine target) (1) ->
“d:\home\workspace\test\XenkoSrc\sources\engine\Xenko.Engine\Xenko.Engine.csproj”(Build target) (2) ->
“d:\home\workspace\test\XenkoSrc\sources\engine\Xenko.Engine\Xenko.Engine.csproj”(Build target) (2:5) ->
(CoreCompile target) ->
Starter\AndroidXenkoActivity.cs(134,82): error CS0117: '“Resource” no “Layout” define [d:\home\workspace\test\XenkoSrc\sources\engine\Xenko.Engine\Xenko.Engine.csproj]
Starter\AndroidXenkoActivity.cs(136,81): error CS0117: '“Resource”未包含“Id”的定义 [d:\home\workspace\test\XenkoSrc\sources\engine\Xenko.Engine\Xenko.Engine.csproj]
Starter\AndroidXenkoActivity.cs(143,41): error CS0117: '“Resource”未包含“Layout”的定义 [d:\home\workspace\test\XenkoSrc\sources\engine\Xenko.Engine\Xenko.Engine.csproj]
Starter\AndroidXenkoActivity.cs(144,68): error CS0117: '“Resource”未包含“Id”的定义 [d:\home\workspace\test\XenkoSrc\sources\engine\Xenko.Engine\Xenko.Engine.csproj]
Starter\AndroidXenkoActivity.cs(151,98): error CS0117: '“Resource”未包含“Id”的定义 [d:\home\workspace\test\XenkoSrc\sources\engine\Xenko.Engine\Xenko.Engine.csproj]

But I don't understand why emit this error

yangguosdxl added a commit to yangguosdxl/xenko that referenced this issue Feb 7, 2020
xen2 pushed a commit that referenced this issue Feb 8, 2020
phr00t pushed a commit to phr00t/FocusEngine that referenced this issue Feb 9, 2020
Ethereal77 pushed a commit to Ethereal77/stride that referenced this issue Feb 10, 2020
@Basewq
Copy link
Contributor

Basewq commented Apr 17, 2020

For anyone on version 3.1.0.1 (ie. official release), try this workaround:
Edit your [GAMENAME].Android.csproj file in Notepad (or any text editor).
Add the following at the end, but still inside <Project> </Project>:

<Project ....>
  [OTHER STUFF]

  <Target Name="AddCustomAliases" BeforeTargets="FindReferenceAssembliesForReferences;ResolveReferences">
    <ItemGroup>
      <ReferencePath Condition="'%(FileName)' == 'Xenko' AND '%(ReferencePath.NuGetPackageId)' == 'Xenko'">
        <Aliases>XenkoFull</Aliases>
      </ReferencePath>
    </ItemGroup>
  </Target>
</Project>

Note this will (hopefully) not be needed in the next official release, as yangguosdxl has pushed a proper fix for this issue.

@ghost
Copy link

ghost commented Jan 5, 2021

With the current 4.0.0 version it still gives this error, when will it be fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working platform-Android
Projects
None yet
Development

No branches or pull requests

7 participants