我们有一个使用Xamarin Forms和共享代码(.NET Standard 2.0)构建的Xamarin.Android应用程序,并尝试在我们的构建服务器上构建它,并在其中连续失败并出现以下错误:
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'.
以下是值得注意的要点:
我到目前为止尝试的解决方案包括:
现在已经挣扎了两天。任何帮助都感激不尽。
以下是帮助我最终构建项目的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恢复要么无法正常工作,要么在接下来的步骤中清理干净就是清理nuget。如果有人想进一步调查,最受欢迎。如果我弄明白的话,我会发布明确的答案,但现在这个YAML正在运作。