概要
マルチモジュール構成で依存関係を見ようと以下のコマンドを打ったところ
$ ./gradlew -q :app:dependencies --configuration releaseCompileClasspath
以下のエラーが出ました
FAILURE: Build failed with an exception.
* Where:
Build file '<パス>/build.gradle' line: 2
* What went wrong:
An exception occurred applying plugin request [id: 'com.android.library']
> Failed to apply plugin 'com.android.internal.library'.
> Accessing GradleBuildProject.Builder through AnalyticsConfiguratorService is not allowed after AnalyticsService is created.
調べるとこれは、Android Gradle Plugin の バージョン7のバグのようです。8では直るみたいです。
https://issuetracker.google.com/issues/226095015
対処方法
そのうち直ると思いますが、対処方法を。
~/.android/analytics.settings
の hasOptedIn
をfalseにすれば良いです。
$ vim ~/.android/analytics.settings
- {"userId":"・・・・","hasOptedIn":true,"・・・・
+ {"userId":"・・・・","hasOptedIn":false,"・・・・
これで無事にコマンド成功しました