Xamarin.Forms Android project builds and runs locally on two machines; fails in Visual Studio Team Services - xamarin.forms

I have a solution that contains an ASP.Net Core web-api project, a Xamarin.Forms app with an Android, iOS and Shared Netstandard library project, along with 5 other NetStandard libraries that are shared between the Xamarin app and the ASP.Net Core app.
I am able to compile and run the Android app on two different local machines, one being Windows 10 and another being macOS Sierra. When I have Visual Studio Team Services (VSTS) clone the repository from BitBucket and build the Android project, it fails to build because of Android resource file issues. I assume the problem is that I don't have VSTS configured correctly, since this runs on two different machines for me without issue. I'm not sure what I have misconfigured in VSTS to solve the issue.
I have a complete reproducible project available for download for uploading to VSTS if anyone needs that.
The build output is large, so I've included the errors themselves below with a link to the entire build output from VSTS.
"d:\a\1\s\dotnet\Apps\Mobile\Mobile.Android\Mobile.Android.csproj" (PackageForAndroid target) (1) ->
(_UpdateAndroidResgen target) ->
Resources\values\styles.xml(2): error APT0000: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'. [d:\a\1\s\dotnet\Apps\Mobile\Mobile.Android\Mobile.Android.csproj]
Resources\values\styles.xml(3): error APT0000: Error: No resource found that matches the given name: attr 'colorAccent'. [d:\a\1\s\dotnet\Apps\Mobile\Mobile.Android\Mobile.Android.csproj]
Resources\values\styles.xml(2): error APT0000: Error: No resource found that matches the given name: attr 'colorPrimary'. [d:\a\1\s\dotnet\Apps\Mobile\Mobile.Android\Mobile.Android.csproj]
Resources\values\styles.xml(2): error APT0000: Error: No resource found that matches the given name: attr 'colorPrimaryDark'. [d:\a\1\s\dotnet\Apps\Mobile\Mobile.Android\Mobile.Android.csproj]
Resources\values\styles.xml(2): error APT0000: Error: No resource found that matches the given name: attr 'windowActionBar'. [d:\a\1\s\dotnet\Apps\Mobile\Mobile.Android\Mobile.Android.csproj]
Resources\values\styles.xml(4): error APT0000: Error: No resource found that matches the given name: attr 'windowActionModeOverlay'. >[d:\a\1\s\dotnet\Apps\Mobile\Mobile.Android\Mobile.Android.csproj]
Resources\values\styles.xml(2): error APT0000: Error: No resource found that matches the given name: attr 'windowNoTitle'. [d:\a\1\s\dotnet\Apps\Mobile\Mobile.Android\Mobile.Android.csproj]
Resources\values\styles.xml(4): error APT0000: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.Dialog'. [d:\a\1\s\dotnet\Apps\Mobile\Mobile.Android\Mobile.Android.csproj]
Resources\values\styles.xml(4): error APT0000: Error: No resource found that matches the given name: attr 'colorAccent'. [d:\a\1\s\dotnet\Apps\Mobile\Mobile.Android\Mobile.Android.csproj]
Resources\values\styles.xml(5): error APT0000: Error: No resource found that matches the given name: attr 'colorAccent'. [d:\a\1\s\dotnet\Apps\Mobile\Mobile.Android\Mobile.Android.csproj]
Resources\values\styles.xml(4): error APT0000: Error: No resource found that matches the given name: attr 'colorPrimary'. [d:\a\1\s\dotnet\Apps\Mobile\Mobile.Android\Mobile.Android.csproj]
Resources\values\styles.xml(4): error APT0000: Error: No resource found that matches the given name: attr 'colorPrimaryDark'. [d:\a\1\s\dotnet\Apps\Mobile\Mobile.Android\Mobile.Android.csproj]
Resources\values\styles.xml(5): error APT0000: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.NoActionBar'. [d:\a\1\s\dotnet\Apps\Mobile\Mobile.Android\Mobile.Android.csproj]
The following is my VSTS Build Definition:
NuGet Restore
Android build
Definition Options
What have I got configured incorrectly that's causing this to fail with the Android resources in VSTS, but not when I build locally?
Local Environment
Windows
Operating System: Windows 10
Visual Studio 2017 15.3 Preview 3
dotnet --version: 1.1.0-preview1-005051
Mac
Operating System: Sierra 10.12.5
Visual Studio for Mac Community - 7.1 Preview (build 583)
Alpha Channel
dotnet --version: 2.0.0-preview3-006815
App Info
Xamarin.Forms shared NetStandard library packages:
Xamarin.Forms: 2.3.5.256-pre6
NetStandard.Library: 1.6.1
Xamarin.Android packages
Xamarin.Android.Support.Design: 25.3.1
Xamarin.Android.Support.v4: 25.3.1
Xamarin.Android.Support.v7.AppCompat: 25.3.1
Xamarin.Android.Support.v7.CardView: 25.3.1
Xamarin.Android.Support.v7.MediaRouter: 25.3.1
Xamarin.Android Framework
MonoAndroid, Version=v7.1
Minimum Android Version: 4.4, API Level 19
Target Android Version: 7.1, API Level 25
Target Framework: 7.1
Final thoughts
I am using project.json for the Xamarin.Android and Xamarin.iOS projects to maange the nuget packages, instead of packages.config, so I can use transitive dependencies. Is there something specific about my two environments that I need to configure in VSTS? I'm using two different versions of dotnet core as well without any issues, so I'm really confused what's going on here.

Use "Visual Studio Build" task instead of "Xamarin.Android" task to run the build. Add /t:PackageForAndroid argument in the task if you want to generate apk package.

Related

azure devops dotnet core app : why "dotnet restore" job fails?

I have an azure pipeline for a dotnet core app, and when it executes this job , i got:
2023-02-16T17:02:26.7325011Z 1>C:\hostedtoolcache\windows\dotnet\sdk\6.0.406\NuGet.targets(132,5): error : '6.1.6,6.2.3' is not a valid version string. [D:\a\1\s\WebApp\WebApp.csproj]
2023-02-16T17:02:26.7944327Z System.ArgumentException: '6.1.6,6.2.3' is not a valid version string.
2023-02-16T17:02:26.7945294Z at NuGet.Versioning.VersionRange.Parse(String value, Boolean allowFloating)
2023-02-16T17:02:26.7946303Z at NuGet.Versioning.VersionRange.Parse(String value)
2023-02-16T17:02:26.7947172Z at NuGet.Commands.MSBuildRestoreUtility.AddPackageReferences(PackageSpec spec, IEnumerable`1 items, Boolean isCpvmEnabled)
2023-02-16T17:02:26.7948010Z at NuGet.Commands.MSBuildRestoreUtility.GetPackageSpec(IEnumerable`1 items)
2023-02-16T17:02:26.7948973Z at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
2023-02-16T17:02:26.7949761Z at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
2023-02-16T17:02:26.7950412Z at NuGet.Commands.MSBuildRestoreUtility.GetDependencySpec(IEnumerable`1 items)
2023-02-16T17:02:26.7951037Z at NuGet.Build.Tasks.RestoreTask.ExecuteAsync(ILogger log)
2023-02-16T17:02:26.7951399Z Done executing task "RestoreTask" -- FAILED.
2023-02-16T17:02:26.7951774Z 1>Done building target "Restore" in project "WebApp.csproj" -- FAILED.
2023-02-16T17:02:26.7961752Z 1>Done Building Project "D:\a\1\s\WebApp\WebApp.csproj" (Restore target(s)) -- FAILED.
2023-02-16T17:02:26.8025517Z
2023-02-16T17:02:26.8026122Z Build FAILED.
2023-02-16T17:02:26.8029367Z
2023-02-16T17:02:26.8030306Z "D:\a\1\s\WebApp\WebApp.csproj" (Restore target) (1) ->
2023-02-16T17:02:26.8030690Z (Restore target) ->
2023-02-16T17:02:26.8031149Z C:\hostedtoolcache\windows\dotnet\sdk\6.0.406\NuGet.targets(132,5): error : '6.1.6,6.2.3' is not a valid version string. [D:\a\1\s\WebApp\WebApp.csproj]
2023-02-16T17:02:26.8031458Z
2023-02-16T17:02:26.8031674Z 0 Warning(s)
2023-02-16T17:02:26.8031958Z 1 Error(s)
2023-02-16T17:02:26.8033465Z
2023-02-16T17:02:26.8034195Z Time Elapsed 00:00:00.91
2023-02-16T17:02:26.8611133Z ##[error]Error: The process 'C:\hostedtoolcache\windows\dotnet\dotnet.exe' failed with exit code 1
2023-02-16T17:02:26.8625609Z ##[error]Packages failed to restore
2023-02-16T17:02:26.8631699Z Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
2023-02-16T17:02:26.8710382Z ##[section]Finishing: Restore Nuget Packages
I am unable to figure out why, any help please ?
In your error you can see it says
System.ArgumentException: '6.1.6,6.2.3' is not a valid version string.
And indeed your problem is actually in this file: https://github.com/MohamedBenighil/WebAppWithDatabaseDemo/blob/055037f9f22bdac6db2edadeab01b412f3c4dca2/WebApp/WebApp.csproj
where you have that invalid Version string in your package reference:
<PackageReference Include="System.Management.Automation" Version="6.1.6,6.2.3" />

Deploy Qt Design Studio Project for Webassembly

I am using Qt 6.3.2 and im on a M1 Mac.
I am trying to build a Qt Design Studio Project for webassembly but I have trouble to install the Designer Components for Webassembly.
To use a Design Studio Project, you have to install the Designer Components to your Installation, which I did like stated in the documentation:Adding Qt Quick Designer Components to Qt Installations.
This works fine when I build it for Mac but I cant get it to work with WASM. Do I need to build the components in a specific way for em++?
When I use the components like stated in the docs I get the following error message:
em++: warning: unrecognized file type: `/Users/marius/Qt/6.3.2/wasm_32/./qml/QtQuick/Studio/Effects/libquickstudioeffectsplugin.dylib`. Mapping to `-lquickstudioeffectsplugin` and hoping for the best [-Wmap-unrecognized-libraries]
em++: warning: unrecognized file type: `/Users/marius/Qt/6.3.2/wasm_32/./qml/QtQuick/Studio/Application/libquickstudioapplicationplugin.dylib`. Mapping to `-lquickstudioapplicationplugin` and hoping for the best [-Wmap-unrecognized-libraries]
em++: warning: unrecognized file type: `/Users/marius/Qt/6.3.2/wasm_32/./qml/QtQuick/Studio/EventSimulator/libquickstudioeventsimulatorplugin.dylib`. Mapping to `-lquickstudioeventsimulatorplugin` and hoping for the best [-Wmap-unrecognized-libraries]
em++: warning: unrecognized file type: `/Users/marius/Qt/6.3.2/wasm_32/./qml/QtQuick/Studio/EventSystem/libquickstudioeventsystemplugin.dylib`. Mapping to `-lquickstudioeventsystemplugin` and hoping for the best [-Wmap-unrecognized-libraries]
wasm-ld: error: unable to find library -lquickstudioeffectsplugin
wasm-ld: error: unable to find library -lquickstudioapplicationplugin
wasm-ld: error: unable to find library -lquickstudioeventsimulatorplugin
wasm-ld: error: unable to find library -lquickstudioeventsystemplugin
em++: error: '/Users/marius/Documents/Git/emsdk/upstream/bin/wasm-ld #/var/folders/k3/prb53mjs50sf220pb_trz4fc0000gn/T/emscripten_7udnbcap.rsp.utf-8' failed (returned 1)
ninja: build stopped: subcommand failed.
I tried to build the components for other architectures or as a static library.

Error running flutter project using Firebase Database

I've been having this issue after adding firebase_database: ^7.0.0-dev.2 to my project. I've also looked at other issues on GitHub, here on S/O, and on the Flutter repo but to no success.
Some of the troubleshooting attempts I have tried include:
deleting the pod files, Podfile, Podfile.lock, etc.
running flutter clean and flutter pub get
running pod install
I've created a new flutter project and added firebase_core: ^1.1.0 and firebase_database: ^7.0.0-dev.2 to the pubspec.yaml. Therefore, I know the issue is not because of dependency conflicts with other flutter packages in my project.
Here is the output from the debug log when I try to run it on a simulator:
Launching lib/main.dart on iPad Pro (12.9-inch) (2nd generation) in debug mode...
Running pod install... 1,832ms
Running Xcode build...
Xcode build done. 3.4s
Failed to build iOS app
Error output from Xcode build:
↳
objc[4399]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x1f1f7c188) and ?? (0x117eb02b8). One of the two will be used. Which one is undefined.
objc[4399]: Class AMSupportURLSession is implemented in both ?? (0x1f1f7c1d8) and ?? (0x117eb0308). One of the two will be used. Which one is undefined.
** BUILD FAILED **
Xcode's output:
↳
/Users/hetpatel/Documents/MobileApps/FlutterProjects/flutter_application_1/ios/Pods/FirebaseDatabase/FirebaseDatabase/Sources/Realtime/FWebSocketConnection.m:22:9: fatal error:
'FirebaseCore/Sources/Private/FirebaseCoreInternal.h' file not found
#import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/hetpatel/Documents/MobileApps/FlutterProjects/flutter_application_1/ios/Pods/FirebaseDatabase/FirebaseDatabase/Sources/Realtime/FWebSocketConnection.m:22:9: note: did not find header
'Sources/Private/FirebaseCoreInternal.h' in framework 'FirebaseCore' (loaded from '/Users/hetpatel/Documents/MobileApps/FlutterProjects/flutter_application_1/build/ios/Debug-iphonesimulator/FirebaseCore')
1 error generated.
In file included from /Users/hetpatel/Documents/MobileApps/FlutterProjects/flutter_application_1/ios/Pods/FirebaseDatabase/FirebaseDatabase/Sources/Core/View/FView.m:18:
In file included from /Users/hetpatel/Documents/MobileApps/FlutterProjects/flutter_application_1/ios/Pods/FirebaseDatabase/FirebaseDatabase/Sources/Api/Private/FIRDatabaseQuery_Private.h:19:
In file included from /Users/hetpatel/Documents/MobileApps/FlutterProjects/flutter_application_1/ios/Pods/FirebaseDatabase/FirebaseDatabase/Sources/Core/FRepo.h:17:
In file included from /Users/hetpatel/Documents/MobileApps/FlutterProjects/flutter_application_1/ios/Pods/FirebaseDatabase/FirebaseDatabase/Sources/Core/FPersistentConnection.h:19:
In file included from /Users/hetpatel/Documents/MobileApps/FlutterProjects/flutter_application_1/ios/Pods/FirebaseDatabase/FirebaseDatabase/Sources/Realtime/FConnection.h:17:
In file included from /Users/hetpatel/Documents/MobileApps/FlutterProjects/flutter_application_1/ios/Pods/FirebaseDatabase/FirebaseDatabase/Sources/Realtime/FWebSocketConnection.h:17:
/Users/hetpatel/Documents/MobileApps/FlutterProjects/flutter_application_1/ios/Pods/FirebaseDatabase/FirebaseDatabase/Sources/Utilities/FUtilities.h:17:9: fatal error: 'FirebaseCore/Sources/Private/FirebaseCoreInternal.h'
file not found
#import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/hetpatel/Documents/MobileApps/FlutterProjects/flutter_application_1/ios/Pods/FirebaseDatabase/FirebaseDatabase/Sources/Utilities/FUtilities.h:17:9: note: did not find header 'Sources/Private/FirebaseCoreInternal.h'
in framework 'FirebaseCore' (loaded from '/Users/hetpatel/Documents/MobileApps/FlutterProjects/flutter_application_1/build/ios/Debug-iphonesimulator/FirebaseCore')
1 error generated.
In file included from /Users/hetpatel/Documents/MobileApps/FlutterProjects/flutter_application_1/ios/Pods/FirebaseDatabase/FirebaseDatabase/Sources/FValueIndex.m:21:
/Users/hetpatel/Documents/MobileApps/FlutterProjects/flutter_application_1/ios/Pods/FirebaseDatabase/FirebaseDatabase/Sources/Utilities/FUtilities.h:17:9: fatal error: 'FirebaseCore/Sources/Private/FirebaseCoreInternal.h'
file not found
#import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/hetpatel/Documents/MobileApps/FlutterProjects/flutter_application_1/ios/Pods/FirebaseDatabase/FirebaseDatabase/Sources/Utilities/FUtilities.h:17:9: note: did not find header 'Sources/Private/FirebaseCoreInternal.h'
in framework 'FirebaseCore' (loaded from '/Users/hetpatel/Documents/MobileApps/FlutterProjects/flutter_application_1/build/ios/Debug-iphonesimulator/FirebaseCore')
1 error generated.
/Users/hetpatel/Documents/MobileApps/FlutterProjects/flutter_application_1/ios/Pods/FirebaseDatabase/FirebaseDatabase/Sources/Core/View/FValueEventRegistration.m:18:9: fatal error:
'FirebaseCore/Sources/Private/FirebaseCoreInternal.h' file not found
#import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/hetpatel/Documents/MobileApps/FlutterProjects/flutter_application_1/ios/Pods/FirebaseDatabase/FirebaseDatabase/Sources/Core/View/FValueEventRegistration.m:18:9: note: did not find header
'Sources/Private/FirebaseCoreInternal.h' in framework 'FirebaseCore' (loaded from '/Users/hetpatel/Documents/MobileApps/FlutterProjects/flutter_application_1/build/ios/Debug-iphonesimulator/FirebaseCore')
1 error generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Analyzing workspace
note: Constructing build description
note: Build preparation complete
/Users/hetpatel/Documents/MobileApps/FlutterProjects/flutter_application_1/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported
deployment target versions is 9.0 to 14.5.99. (in target 'leveldb-library' from project 'Pods')
/Users/hetpatel/Documents/MobileApps/FlutterProjects/flutter_application_1/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported
deployment target versions is 9.0 to 14.5.99. (in target 'Flutter' from project 'Pods')
Could not build the application for the simulator.
Error launching application on iPad Pro (12.9-inch) (2nd generation).
Found a workaround for now:
dropped firebase_core to version "0.7.0" and firebase_database to ^6.0.0

Flutter trying to installing packages

No matter which package I tried to install when running on iOS simulator get an error the same no matter which package.
fatal error: module 'name of the module I'm trying' not found
Is a new MacBook Air, so I can't emulate Android to see if is the same.
Been days stuck here
This is the output:
Failed to build iOS app Error output from Xcode build: ↳
objc[94975]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x1faf938f0) and ?? (0x11acac2b8). One of the two will be
used. Which one is undefined.
objc[94975]: Class AMSupportURLSession is implemented in both ?? (0x1faf93940) and ?? (0x11acac308). One of the two will be used. Which
one is undefined.
** BUILD FAILED **
Xcode's output: ↳
/Users/rafy/Desktop/Flutter_App_with_Android_Studio/cte_baberia/ios/Runner/GeneratedPluginRegistrant.m:10:9:
fatal error: module 'firebase_auth' not found
#import firebase_auth;
~~~~~~~^~~~~~~~~~~~~
1 error generated.
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To
resolve this, select a development team in the Runner editor. (in
target 'Runner' from project 'Runner')
Could not build the application for the simulator. Error launching
application on iPhone 12 Pro Max.
Please run a flutter clean and then post the outputs when you run these commands:
pub get
and
flutter build ios

The realm dot net base example does not compile

I am having trouble at getting the example "QuickJournal" to compile on iOS. The code compiles OK, but fails during the Fody step.
Goals
Try out the example application for .NET through the following
- Pull the repository
- Open the solution in examples/QuickJournal
- Compile and test
Expected Results
Smooth compilation & testing experience
Actual Results
Fody out of memory exception
Steps to Reproduce
See the setup, follow steps
I am using the latest Xamarin/Visual Studio Mac/XCode
Code Sample
The regular realm source code
Version of Realm and Tooling
git clone https://github.com/realm/realm-dotnet.git
git checkout 8f5e36ffd91e06b9c60b91f9de3fb312b411a4a4
The exception I am getting is
Fody: Found debug symbols at '~/realm-dotnet/examples/QuickJournal/QuickJournal/obj/Debug/QuickJournal.pdb'.
MSBUILD : error : Fody: An unhandled exception occurred:
MSBUILD : error : Exception:
MSBUILD : error : Out of memory
MSBUILD : error : StackTrace:
MSBUILD : error : at (wrapper alloc) System.Object:AllocVector (intptr,intptr)
MSBUILD : error : at Microsoft.Cci.Pdb.MsfDirectory..ctor (Microsoft.Cci.Pdb.PdbReader reader,
See log file
RealmCompilelog.txt
Realm 1.2.1 addresses that by using an updated version of Fody.
Answer for older Realm versions:
This is caused by a Cecil bug with Mono 5.0. As Realm depends on Fody, which uses Cecil, compilation will fail for project referencing it. Until new Cecil and Fody versions are released, the workaround is to revert to Mono 4.8:

Resources