2

Trying to get our CI to build our Xamarin.Android apps, I have made a Task for this, and it builds fine the first 2 or 3 times but after that, it constantly throws errors like the one below

C:\agent_work\1\s*\obj\Xamarin\110\lp\104\jl\res\values-sq\values.xml(1): error APT2254: xml parser error: no element found. [C:\agent_work\1\s\Implementations*.csproj

[error]C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Aapt2.targets(157,3): Error APT2260: resource style/Theme.AppCompat.Light.DarkActionBar (aka ****:style/Theme.AppCompat.Light.DarkActionBar) not found.

our styles xml:

<resources>

  <!-- Base application theme. -->
  <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:titleTextStyle">@android:color/white</item>
    <item name="android:textColor">@android:color/white</item>
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
  </style>

  <style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
  </style>

  <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

  <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
  <style name="Theme.Splash" parent="android:Theme">
    <item name="android:windowBackground">@drawable/drawable_splashscreen</item>
    <item name="android:windowNoTitle">true</item>
  </style>
</resources>

EDIT: I already have on the pipeline:

  1. All nuget are restored, and set to not use cache (even with cache it still fails)
  2. All Obj/Bins folders are deleted before build (has been confirmed)
  3. Clean and Restore are called before Build also.
  4. Full Post Build Cleanup task
Rune Jørgensen
  • 281
  • 1
  • 3
  • 7
  • Sounds like either 1. you are not cleaning properly in between builds or 2. you are not restoring NuGet packages. – Cheesebaron Aug 12 '21 at 09:03
  • I do both, have /t:restore /t:clean, and even made a custom task and cleans all bin/obj folders – Rune Jørgensen Aug 12 '21 at 09:24
  • You can try to delete the bin folders and the obj folders and rebuild it . If it still doesn’t work ,try to restart the VS . – Jessie Zhang -MSFT Aug 13 '21 at 02:45
  • @JessieZhang-MSFT Already delete bin/obj folders, have even done it manually after a build that has failed. Also not using VS, using VSTS (Azure pipelines) – Rune Jørgensen Aug 13 '21 at 06:52
  • If it is convinient for you, could you please post a basic demo to github or onedriver so that we can try to reproduce this problem on our side? – Jessie Zhang -MSFT Aug 13 '21 at 08:00
  • @JessieZhang-MSFT Sadly the code is proprietary, and also our pipeline setup would be difficult to reproduce exactly on other machines. And it compiles fine on my local VS 2019's machine and across atleast 2 other developers. VS2019 was also installed on the build agent, but it made no difference to the build pipeline. The VS2019 on the build agent can also build it without problems. Would any info from build log help? – Rune Jørgensen Aug 13 '21 at 11:48
  • Do other apps have this problem? – Jessie Zhang -MSFT Aug 16 '21 at 08:29
  • @JessieZhang-MSFT we have 2 xamarin.android app, both fail. The rest of our solution 100+ projects builds just fine. (the xamarin projects have been made to run in their own pipeline task as not to distrub our normal CI) – Rune Jørgensen Aug 17 '21 at 06:27
  • You can try to create a new app ,then copy all the possible code to the new one and try again. – Jessie Zhang -MSFT Aug 18 '21 at 05:26
  • @JessieZhang-MSFT Got same error :( – Rune Jørgensen Aug 18 '21 at 07:13
  • So weird. You can try to repair your Visual studio. Check: https://learn.microsoft.com/en-us/visualstudio/install/repair-visual-studio?view=vs-2019 . – Jessie Zhang -MSFT Aug 19 '21 at 06:45
  • @JessieZhang-MSFT have done repair, full uninstall, install, even tried with just visual studio build tools, remember this is a build agent. – Rune Jørgensen Aug 19 '21 at 12:22

0 Answers0