Why not login to Qiita and try out its useful features?

We'll deliver articles that match you.

You can read useful information later.

0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

テスト時に起きるエラー対処: Execution failed for task ':app:processDebugLocalGoogleServices'.

Last updated at Posted at 2024-04-19

概要

Androidのモバイルアプリ開発において、CD/CIの設定などで ./gradlew test コマンドによるユニットテストを実行したい時がありました。しかし、Firebaseのエラーが起きてテストを実行できませんでした。
エラー内容は

Execution failed for task ':app:processDebugLocalGoogleServices'. 

バリアントを複数設定しているときにパッケージ名をうまく探せないようで起きてしまうようです。

解決策

環境を指定してテストを実行すると直りました。

 ./gradlew testDebugUnitTest  

debugの箇所は設定しているビルドバリアントです。
例えば stage バリアントがあるのならば次のようでも良いです。

 ./gradlew testStageUnitTest  

<参考>

NGな解決策

次で紹介されているappレベルのgradleから

gradle
apply plugin: 'com.google.gms.google-services'

を消す方法でもテストは動くようになるのですが、これはNGです。理由は明白で、Firebaseの公式で設定時に追加するように明記されているためです。消さないようにしましょう....

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up

Qiita Conference 2025 will be held!: 4/23(wed) - 4/25(Fri)

Qiita Conference is the largest tech conference in Qiita!

Keynote Speaker

ymrl、Masanobu Naruse, Takeshi Kano, Junichi Ito, uhyo, Hiroshi Tokumaru, MinoDriven, Minorun, Hiroyuki Sakuraba, tenntenn, drken, konifar

View event details
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?