Xamarinでのエラー

foramsでつくったプロジェクトでエラーが頻発しているのでその記録。

最初ファイルパッケージほにゃららが存在しません(パッケージは存在する)というエラーが頻出していたが、これはどうもXamarin.Androidが、Android SDK Build-tools Version 24に対応していなかったために起こっていたようなのでversion24関連を全部アンインストールすることで解消。

  1. Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
  2. No resource found that matches the given name: attr 'colorAccent'.
  3. No resource found that matches the given name: attr 'colorPrimary'.
  4. No resource found that matches the given name: attr 'colorPrimaryDark'.
  5. No resource found that matches the given name: attr 'windowActionBar'.
  6. No resource found that matches the given name: attr 'windowActionModeOverlay'.
  7. No resource found that matches the given name: attr 'windowNoTitle'.
  8. Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.Dialog'.
  9. No resource found that matches the given name: attr 'colorAccent'.

↑特に何もいじっていない、デフォルトのプロジェクトを展開したはずなのにビルドできずエラーが出る。1、8に関してはソースの該当箇所をparent="android:Theme.Light"と別のものに置き換えることで解決。2〜7、9についてはコードに原因があるのかと思いきや今度はSDKBuild-toolsのversion23が入っていることで起こっているんじゃないかと議論しているので(Issue 183122 - android - Error retrieving parent for Item - AppCompact-v7 23 - Android Open Source Project - Issue Tracker - Google Project Hosting)、version23をアンインストールすることで解決した。

全部解決したかと思いきやバージョンが古くなりすぎたのか'Android SDK Build-tools' is in use which this version of Android Support Library does not support.と言われYou also need to install 'Android SDK Build-tools' version 23.0.0 or higher.とも言われたのでとりあえず23、24以外でversion25.00を入れたもののdoes not supportと言われいったんどうしようか考え中。SDKをインストールしたりアンインストールしたりする以外の解決方法があればそのほうがいいのかもしれないが……。

またリビルドすると大量にPlease install package: 'Xamarin.Android.Support.v7.RecyclerView'系の必要パッケージをインストールしてくださいというエラーが20以上出るが、すべてデフォルトで入っているので何がなんだかわからない。最新のバージョンでないのは確かで、パッケージ(Android.support系)を更新することで直りますよというQ&Aの結果が一番多いので一番最初に試してみたのだが、相互に依存関係のあるパッケージ間でバージョン差が発生するために更新できませんというエラーが出て更新できず対応方法を検討中。もしくはSDKで必要な物がダウンロードされていないのかと思ったが、extras含め一通り入れているので確認する。

↑追記。Please install package系のエラーはどうも最初のパッケージインストールが不完全に終わってしまっていたから発生していたもののようで、いったんすべて削除して再度ビルドしたことできれいに解消されたので、あと解決が必要にみえるのはSDK周りのエラーのみになった。