我们有一个Xamarin.Android应用程序,该应用程序使用Xamarin Forms和共享代码(.NET Standard 2.0)构建,并尝试在我们的构建服务器上进行构建,在该服务器上,它连续失败并出现以下错误:
Mobile.Android\Resources\values\styles.xml(2,0): Error APT0000: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
Mobile.Android\Resources\values\styles.xml(2,0): Error APT0000: No resource found that matches the given name: attr 'colorAccent'.
Mobile.Android\Resources\values\styles.xml(2,0): Error APT0000: No resource found that matches the given name: attr 'colorPrimary'.
Mobile.Android\Resources\values\styles.xml(2,0): Error APT0000: No resource found that matches the given name: attr 'colorPrimaryDark'.
Mobile.Android\Resources\values\styles.xml(2,0): Error APT0000: No resource found that matches the given name: attr 'windowActionBar'.
Mobile.Android\Resources\values\styles.xml(2,0): Error APT0000: No resource found that matches the given name: attr 'windowActionModeOverlay'.
Mobile.Android\Resources\values\styles.xml(2,0): Error APT0000: No resource found that matches the given name: attr 'windowNoTitle'.
Mobile.Android\Resources\values\styles.xml(2,0): Error APT0000: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.Dialog'.
Mobile.Android\Resources\values\styles.xml(2,0): Error APT0000: No resource found that matches the given name: attr 'colorAccent'.
Mobile.Android\Resources\values\styles.xml(2,0): Error APT0000: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
Mobile.Android\Resources\values\styles.xml(2,0): Error APT0000: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.NoActionBar'.
以下是值得注意的要点:
到目前为止,我尝试过的解决方案包括:
现在为此奋斗了2天。我们将不胜感激。
答案 0 :(得分:0)
以下是帮助我最终构建项目的YAML配置。
resources:
- repo: self
clean: true
queue:
name: Default
demands:
- MSBuild
- Xamarin.Android
- JDK
- AndroidSDK
variables:
BuildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@0
displayName: 'Use NuGet 4.4.1'
inputs:
versionSpec: 4.4.1
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: '$(Parameters.restorePkgSolution)'
- task: XamarinAndroid@1
displayName: 'Build Mobile.Android'
inputs:
projectFile: Mobile.Android/Mobile.Android.csproj
outputDirectory: '$(build.binariesdirectory)/$(BuildConfiguration)'
configuration: '$(BuildConfiguration)'
- task: AndroidSigning@1
displayName: 'Signing and aligning APK file(s) $(build.binariesdirectory)/$(BuildConfiguration)/*.apk'
inputs:
files: '$(Parameters.appFiles)'
keystoreFile: '<path>'
keystorePass: <password>
keystoreAlias: <alias>
keyPass: <pass>
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
inputs:
PathtoPublish: '$(build.binariesdirectory)/$(BuildConfiguration)'
此管道与失败的先前管道之间的差异是:
所以我仍然不是100%地确定我做错了什么,但是我最大的猜测是nuget restore不能正常工作,或者在下一步中清理的是清理nuget。 如果有人想进一步调查,非常欢迎。如果可以解决的话,我会发布明确的答案,但目前此YAML可以正常工作。