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

Fix android template issues #1456

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Draft

Conversation

ykafia
Copy link
Contributor

@ykafia ykafia commented Jul 17, 2022

PR Details

Noticed 3 issues in the android template :

  • possible "app_text"/"app_name" confusion
  • The project name is not picked up in the layout
  • The resources.designer.cs contains const int and are tried to be set, possible resource file issue

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • Update template app_text to app_name.
  • Find issue with the resources.designer.cs generation.
  • Find issue with the project name replacement

@xen2
Copy link
Member

xen2 commented Jul 17, 2022

It seems the PR doesn't contain all those 3 changes, only 1 of them (and one unrelated gitignore change)?

@ykafia
Copy link
Contributor Author

ykafia commented Jul 17, 2022

Yes! i'm still investigating it, i should mark it as a draft so far

@ykafia ykafia marked this pull request as draft July 17, 2022 13:48
@ykafia
Copy link
Contributor Author

ykafia commented Jul 17, 2022

I've solved two out of three issues but i have one last related to the resource.designer.cs file generated by xamarin.

It creates const fields and sets them in a static function which breaks everything, so i assume there might be a xamarin dependency version issue somewhere, but i can't find anything to help me with that.

If any one has a better guess i'd love to hear it

@@ -1,3 +1,2 @@
<resources>
<string name="app_name"><#= Properties.PackageGameDisplayName #></string>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<Properties.PackageGameDisplayName/> works too, doesn't need to be deleted

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it was only for TextView which You deleted then ignore comment.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the hint, do you have experience with .NET6 and android? would be nice to get this PR moving forward a bit...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to migrate my Android project from Unity so I've already started looking for the source of the problem with Resources.Designer.cs, but it's harder than i thought. I'll focus on it tomorrow.

@Feralnex
Copy link

@ykafia any ideas how to build nuget packages (....nuget\packages folders) also for net6.0-android when building Stride solution? It builds only for net6.0 and I can't reference some of the stride nuget packages inside Android project. Working on current master branch to resolve the issue with resources and this problem got in my way...

@ykafia
Copy link
Contributor Author

ykafia commented Nov 23, 2022

@Feralnex so I'm not a msbuild expert but I build both Stride.sln and Stride.Android.sln

They get added to a local storage, just building is enough to have them available on your machine.

There might be another way to build both with one command though

@manio143
Copy link
Member

You can set StridePlatforms=Windows;Android and StrideGraphicsApiDependentBuildAll=true properties in Directory.Build.props

@Feralnex
Copy link

@manio143 couldn't find file to set those properties, but I noticed that i can run script:

set StridePlatforms=Windows;Android
set StrideGraphicsApiDependentBuildAll=true
Stride.sln

But it produces errors inside Visual Studio when i try to build GameStudio...

Error	NETSDK1005	Assets file 'E:\Stride Projects\stride\sources\engine\Stride.UI\obj\project.assets.json' doesn't have a target for 'net6.0-android'. Ensure that restore has run and that you have included 'net6.0-android' in the TargetFrameworks for your project.	Stride.UI	C:\Program Files\dotnet\sdk\6.0.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets	267	
Error	NETSDK1005	Assets file 'E:\Stride Projects\stride\sources\tools\Stride.Graphics.RenderDocPlugin\obj\project.assets.json' doesn't have a target for 'net6.0-android'. Ensure that restore has run and that you have included 'net6.0-android' in the TargetFrameworks for your project.	Stride.Graphics.RenderDocPlugin	C:\Program Files\dotnet\sdk\6.0.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets	267	
Error	NETSDK1005	Assets file 'E:\Stride Projects\stride\sources\engine\Stride.Voxels\obj\project.assets.json' doesn't have a target for 'net6.0-android'. Ensure that restore has run and that you have included 'net6.0-android' in the TargetFrameworks for your project.	Stride.Voxels	C:\Program Files\dotnet\sdk\6.0.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets	267	
Error	NETSDK1005	Assets file 'E:\Stride Projects\stride\sources\engine\Stride.SpriteStudio.Runtime\obj\project.assets.json' doesn't have a target for 'net6.0-android'. Ensure that restore has run and that you have included 'net6.0-android' in the TargetFrameworks for your project.	Stride.SpriteStudio.Runtime	C:\Program Files\dotnet\sdk\6.0.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets	267	
Error	NETSDK1005	Assets file 'E:\Stride Projects\stride\sources\engine\Stride.Rendering\obj\project.assets.json' doesn't have a target for 'net6.0-android'. Ensure that restore has run and that you have included 'net6.0-android' in the TargetFrameworks for your project.	Stride.Rendering	C:\Program Files\dotnet\sdk\6.0.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets	267	
Error	NETSDK1005	Assets file 'E:\Stride Projects\stride\sources\engine\Stride.Physics\obj\project.assets.json' doesn't have a target for 'net6.0-android'. Ensure that restore has run and that you have included 'net6.0-android' in the TargetFrameworks for your project.	Stride.Physics	C:\Program Files\dotnet\sdk\6.0.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets	267	
Error	NETSDK1005	Assets file 'E:\Stride Projects\stride\sources\engine\Stride.Particles\obj\project.assets.json' doesn't have a target for 'net6.0-android'. Ensure that restore has run and that you have included 'net6.0-android' in the TargetFrameworks for your project.	Stride.Particles	C:\Program Files\dotnet\sdk\6.0.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets	267	
Error	NETSDK1005	Assets file 'E:\Stride Projects\stride\sources\engine\Stride.Navigation\obj\project.assets.json' doesn't have a target for 'net6.0-android'. Ensure that restore has run and that you have included 'net6.0-android' in the TargetFrameworks for your project.	Stride.Navigation	C:\Program Files\dotnet\sdk\6.0.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets	267	
Error	NETSDK1005	Assets file 'E:\Stride Projects\stride\sources\engine\Stride.Input\obj\project.assets.json' doesn't have a target for 'net6.0-android'. Ensure that restore has run and that you have included 'net6.0-android' in the TargetFrameworks for your project.	Stride.Input	C:\Program Files\dotnet\sdk\6.0.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets	267	
Error	NETSDK1005	Assets file 'E:\Stride Projects\stride\sources\engine\Stride.Engine\obj\project.assets.json' doesn't have a target for 'net6.0-android'. Ensure that restore has run and that you have included 'net6.0-android' in the TargetFrameworks for your project.	Stride.Engine	C:\Program Files\dotnet\sdk\6.0.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets	267	

Probably i'm doing something wrong, but before changing those properties everything was fine.

@Feralnex
Copy link

Maybe the problem lies somewhere else... The reason why I'm asking about it is that after creating Android project in built Stride (and Android earlier) the MyGameActivity.cs has errors:

Severity	Code	Description	Project	File	Line	Suppression State
Error	CS0103	The name 'GameContext' does not exist in the current context	MyGame6.Android	E:\Stride Projects\MyGame6\MyGame6.Android\MyGame6Activity.cs	24	Active
Error	CS0246	The type or namespace name 'StrideActivity' could not be found (are you missing a using directive or an assembly reference?)	MyGame6.Android	E:\Stride Projects\MyGame6\MyGame6.Android\MyGame6Activity.cs	15	Active
Error	CS0234	The type or namespace name 'Starter' does not exist in the namespace 'Stride' (are you missing an assembly reference?)	MyGame6.Android	E:\Stride Projects\MyGame6\MyGame6.Android\MyGame6Activity.cs	6	Active

@manio143
Copy link
Member

Did you try to rebuild (or clean, then build)? Regarding props file - you can see examples on the web, it's very similar to how csproj is written.

@Feralnex
Copy link

@manio143 even during clean similar errors pop up... when trying to rebuild over 12k errors pop up...

@tebjan
Copy link
Member

tebjan commented Nov 24, 2022

@manio143 even during clean similar errors pop up... when trying to rebuild over 12k errors pop up...

Just a sanity check, did you check out the stride sources with git lfs enabled?

@Feralnex
Copy link

@tebjan yes

@ykafia
Copy link
Contributor Author

ykafia commented Dec 1, 2022

If anyone has time to try this, I'll do something this weekend if I get some time.

The resource designer issue might be an issue of conflicting namespace

@tebjan
Copy link
Member

tebjan commented Mar 14, 2023

Is this still an issue after this merge? #1428

@ykafia ykafia marked this pull request as ready for review March 14, 2023 16:36
@Eideren Eideren marked this pull request as draft November 12, 2023 15:47
@Eideren
Copy link
Collaborator

Eideren commented Nov 12, 2023

Changed this to draft given the conflicts introduced by #1833

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants