-
Notifications
You must be signed in to change notification settings - Fork 2
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
Upgrading old Android project to F# 6 #5
Comments
No, this is not required. It will work with packages.config as well.
Did you try to build a 2nd time? |
I have tried to build a second time, without success. Just going back over things in my old project, I switched to the FSharp.Android.Resource NuGet package in my
I commented out this line in my .fsproj file (there was no
In an effort to avoid potential issues, I removed the reference to the old Xamarin.Android.FSharp.ResourceProvider from my .fsproj file: <ItemGroup>
- <Reference Include="Xamarin.Android.FSharp.ResourceProvider.Runtime"> -
- <HintPath>..\packages\Xamarin.Android.FSharp.ResourceProvider.1.0.0.28\lib\monoandroid81\Xamarin.Android.FSharp.ResourceProvider.Runtime.dll</HintPath>
- </Reference>
</ItemGroup> I have checked that the new FSharp.Android.Resource package, version 1.0.2, is installed for the Android project. But unfortunately, the same build errors still occur:
With the new FSharp.Android.Resource package, is the |
Yes. FSharp.Android.Resource is a simple task that makes sure Version 1.0.2 had some issues, so I just pushed a version 1.0.3 which should be better.
I would recommend you use the NuGet Package Manager of your IDE to do that, otherwise you need to do a few things by yourself. If you update
<Import Project="..\packages\FSharp.Android.Resource.1.0.3\build\FSharp.Android.Resource.targets" Condition="Exists('..\packages\FSharp.Android.Resource.1.0.3\build\FSharp.Android.Resource.targets')" /> After that, it should be better. Follow the instructions on the README and it should work. |
Noted. I appreciate the help, @TimLariviere, the build errors now seem to be solved. |
My apologies for resurrecting this issue again, but I seem to have run into a further problem. My (Fabulous v1) Android project does now build in Visual Studio. But when deploying from Visual Studio to a physical device (Samsung S10) for debugging, the app installs on the phone successfully, but when starting, it goes into break mode and shows this error in Visual Studio:
I have been trying to figure out what the issue may be for some days now, without any luck. Any ideas on how I might be able to narrow down the cause? Or is this something that would be better raised with the AndroidX people? In any case, could I ask at which point is the Resource.designer.cs file supposed to be generated? In an effort to try and better understand things, I had temporarily removed the Resource.designer.cs file from my project in order to see if it could be regenerated and perhaps might be different upon regeneration. But (re)building, unloading/loading the project, uninstalling/installing the FSharp.Android.Resource NuGet package, closing/opening Visual Studio etc. doesn't seem to trigger generation of the file. So I put the old file back in place once more, which allows for a successful build, but the break mode error remains upon deployment to the physical device. |
This file is generated during the build of the Android project. FSharp.Android.Resource injects itself just after it to build the C# dll before trying to inject it for the F# build.
Maybe try to remove obj/bin folders?
Does it work in the Android Emulator?
Maybe it is related to the fact you need to explicitly call type MainActivity() =
inherit Activity()
// This is required for the app to pick up the right resources
do YourProject.Resource.UpdateIdValues()
member _.OnCreate(bundle) =
base.OnCreate(bundle)
// Now you can use Resource like usual
this.SetContentView(Resource.Layout.Main) |
Thanks yet again for your help, @TimLariviere. Looking through the build log after running msbuild on the command line, I noticed that the ultimate error was:
Looking further up in the build log I noticed in the
So I thought what if I add the So then I was curious as to whether this was just some idiosyncrasy of my whacky project. I created a brand new Fabulous v2 project (
I then uncommented the So it seems I can reproduce my error even in an out-of-the-box Fabulous v2 Android project by:
Conclusion: it seems best to leave the |
@gaelian Would it be a backward slash I see when you comment out, the path is What happens if you explicitly set I believe you're testing on Windows only, right? |
Yes, I noticed this also, it was one of the first things I tried. But on my machine at least (I'm actually using a Win 10 VM on a Macbook Pro, as I prefer Visual Studio for Windows, but yes, I'm testing on Windows), either of I also tried removing the line from my .fsproj file and then modifying line 4 in the
But this too fails in the same way. So no matter what I've tried so far (and I've been at this for quite some time now!), all signs point to me needing to keep the I have moved to testing on an out of the box Fabulous v2 project now, so I would hope this issue should be easy enough for someone else testing on Windows to reproduce. |
I'm trying to upgrade an old Fabulous project (Xamarin Forms, iOS and Android app) to .NET 6/F# 6. The shared project and iOS project seem to have gone OK but the Android project is giving me these build errors:
The errors refer to the
AssemblyInfo.fs
file.I have changed the
Xamarin.Android.FSharp.ResourceProvider
package reference toFSharp.Android.Resource
and I have removed the<AndroidResgenFile>Resources/Resource.designer.cs</AndroidResgenFile>
from my project file. The<AndroidUseIntermediateDesignerFile>false</AndroidUseIntermediateDesignerFile>
line did not appear in my project file so didn't need to be removed. However, the above build errors persist. The Android app is targeting Android 11, I don't know if that makes a difference to anything.I gather my project is of the old kind, e.g. it has an
AssemblyInfo.fs
file and apackages.config
file. Is it necessary to upgrade to the PackageReference style of project as seen over in FSharp.Mobile.Templates? Or is there some way to get things working with the old project format? If the project format needs to change, does this just need to be done manually?The text was updated successfully, but these errors were encountered: