stride icon indicating copy to clipboard operation
stride copied to clipboard

Fix android template issues

Open ykafia opened this issue 1 year ago • 15 comments

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

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

Checklist

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

ykafia avatar Jul 17 '22 08:07 ykafia

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

xen2 avatar Jul 17 '22 13:07 xen2

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

ykafia avatar Jul 17 '22 13:07 ykafia

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

ykafia avatar Jul 17 '22 14:07 ykafia

@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...

Feralnex avatar Nov 23 '22 19:11 Feralnex

@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

ykafia avatar Nov 23 '22 20:11 ykafia

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

manio143 avatar Nov 23 '22 20:11 manio143

@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 avatar Nov 24 '22 16:11 Feralnex

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

Feralnex avatar Nov 24 '22 17:11 Feralnex

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.

manio143 avatar Nov 24 '22 17:11 manio143

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

Feralnex avatar Nov 24 '22 17:11 Feralnex

@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?

tebjan avatar Nov 24 '22 19:11 tebjan

@tebjan yes

Feralnex avatar Nov 24 '22 20:11 Feralnex

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

ykafia avatar Dec 01 '22 19:12 ykafia

Is this still an issue after this merge? https://github.com/stride3d/stride/pull/1428

tebjan avatar Mar 14 '23 14:03 tebjan

Changed this to draft given the conflicts introduced by #1833

Eideren avatar Nov 12 '23 15:11 Eideren