Google Play Serviceが入ったアプリを Robolectric (正確には Robospock) でテストしようとしたらハマったのでメモ。 追加: 偉そうに長々書きましたが、正しくは RobolectricGradleTestRunner や GradleRoboSputnik を使うのがいいのかもしれません。でも一々 @RunWith で指定するのは面倒そうな気もする。 問題1:正しい AndroidManifestを見つけてくれない GooglePlayServiceを使うには AndroidManifestに metaタグで versionを仕込まなくてはいけません。でも、正しい AndroidManifestを見てくれないと、それが定義されてないのでテストの初期化で以下のように言って落ちます: java.lang.RuntimeException: java.lan