-
Notifications
You must be signed in to change notification settings - Fork 533
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
WearOS app fails to compile when targeting net6.0-android #7003
Comments
Hello @beeradmoore , I think I found a temporary workaround to develop and run Android Wear OS while the official fix is provided. I'm on using .NET 6.0.300, Visual Studio for Mac RC2 and MAUI RC3
Note: I created a Wear OS emulator using Android 11, it is the one you can see on the screenshot I shared above.
I hope this helps with some insights to solve the root cause of the issue with the tooling on VS for Mac or the update for nugets packages officially from Microsoft to support WearOS. |
Oh, neato! Followed your directions and I found a few things. Unsure if this is what the The
warning appears to be because Xamarin.Android.Wear has it as a dependency like that. At this point I have not installed
VS gave me the option to enable building MSBuild on Mono, and a link to this site for more information. But even enabling that I don't get past this error. Even attempted restarting VS but it was a big fat nope. Here is my current project without |
Hello @beeradmoore , I was able to simplify the packages dependencies and compile without any errors and no more warnings on the packages. Please find below the project zipped and a screenshot of the configuration. One thing, I forgot to mention on my previous comment was that I had to increase the Minimum Android Version Target to 6.0 API level 23. However, I believe, I have been using the MonoCompiler instead of the MS Build new project structure, because I noticed that your .csproj is different from the one the VS for Mac 2022 RC2 created automatically for me. |
Hello again @beeradmoore, After being in touch with the community on Discord, we were able to solve the issue. The following project has been updated by removing the old dependencies and just leave the AndroidX ones. Also updated the MainActivity.cs to reflect the new APIs provided on AndroidX. @maddymontaquila do you think the MS can give us a hand to update the VS for Mac and Windows 2022 tooling for creating Android WearOS Apps for .NET 6 new csproj styles and also include the new packages and MainActivity.cs layout, please. Reminder: Set the Minimum Android Version Target to 6.0 API level 23 (it never compiled on version 21 or 22) |
See also:
The big takeaways:
The really big takeaway: we need to update the Wear template in VSMac. |
@vhugogarcia awesome job! I was able to replicate the steps you had done (and with what @jonpryor had said) but to my own project and got it working. With my new project and the two you posted above I still have the same warnings I had before but everything still works. Unsure if I am missing something from being installed.
@jonpryor what server are those discord channels on? When I try go to them it just says no text channel here, probably because I am not on that server. What's the process for submitting/requesting new templates for VS4Mac (and VS for Windows as well I guess) so we can get those updated? |
In .NET 6, template live inside optional workloads, and what was offer right now is here: https://github.com/xamarin/xamarin-android/tree/main/src/Microsoft.Android.Templates Was the mentioned template above for Xamarin.Android? We could add an |
I think they created an old Wear template then converted it. So we should probably do one for .NET 6. |
The ones I was making was with 'dotnet new android' and the copying over things from one templates in VS4mac 2019 to make files match (eg. dimens.xml, activity_main.xml) EDIT: @jonathanpeppers , do you know if workload templates show up in Visual Studio on both Windows and Mac (or at least the preview versions of them both)? |
Fixes dotnet#7003 This speaks for itself, lets add a template for Wear applications.
Fixes dotnet#7003 This speaks for itself, lets add a template for Wear applications.
Fixes dotnet#7003 This speaks for itself, lets add a template for Wear applications.
The templates in VS Mac do not yet support finding templates inside .NET optional workloads -- when that feature is available, it should display the latest .NET 6+ or MAUI templates. So I think we are good to close this? Anyone looking to target Android Wear should try the template in #7013 thanks! |
Fixes dotnet#7003 This speaks for itself, lets add a template for Wear applications.
Fixes dotnet#7003 This speaks for itself, lets add a template for Wear applications.
Fixes dotnet#7003 This speaks for itself, lets add a template for Wear applications.
Fixes dotnet#7003 This speaks for itself, lets add a template for Wear applications.
Fixes dotnet#7003 This speaks for itself, lets add a template for Wear applications.
Fixes dotnet#7003 This speaks for itself, lets add a template for Wear applications.
Fixes dotnet#7003 This speaks for itself, lets add a template for Wear applications.
Android application type
Android for .NET (net6.0-android, etc.)
Affected platform version
VS4Mac 2022 Preview (17.0 build 8904), .NET 6.0.300, Xamarin.Android 12.3.0.3
Description
I have been trying to use net6.0-android as the target framework to build a WearOS wearable app after it was mentioned in an (unofficial) .NET MAUI Platforms Support gist that it was supported.
The warnings below seem to indicate
android-31/optional/com.google.android.wearable.jar
is missing when in actual factcom.google.android.wearable.jar
does not exist inandroid-30/optional/
andandroid-28/optional/
which are the other folders I have there.I am unsure if those warnings relate to the R8 compilation or not.
Repro:
WearOSMonoTest.zip
WearOSNet6Test.zip
Extra info:
I did update target framework on the first project to MonoAndroid12.0
I also updated
TargetFramework
tonet6.0-android31
because that is what was listed as the required framework on nuget.org for the nugets I added but I don't believe this is required as it has the same issues if I use net6.0-android.Steps to Reproduce
dotnet new android --name WearOSNet6Test
WearOSMonoTest
project.Did you find any workaround?
Nope.
Relevant log output
The text was updated successfully, but these errors were encountered: