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.
msbuild
against your freshly cloned project in these environments. My guess is that theResource.designer.cs
is not being updated with the proper items from theAppCompat
theme. Perhaps try theUpdateAndroidResources
target prior to usingSignAndroidPackage
- developer.xamarin.com/guides/android/under_the_hood/… – Jon Douglas