LoginSignup
21
9

More than 5 years have passed since last update.

Gradle Pluginを2.3.0にした際にUnresolved referenceが発生してビルドがFAILEDする場合の対処方法

Last updated at Posted at 2017-03-03

概要

Android Studioを2.3にGradle Pluginを2.3.0に上げたところ、以下のようなエラーが発生しました。

Unresolved reference: DaggerAppComponent
Unresolved reference: databinding

現象が発生した際の環境

Kotlin

  • compile "org.jetbrains.kotlin:kotlin-stdlib:1.1.0"

DataBinding関連

  • kapt 'com.android.databinding:compiler:2.2.3'

Dagger関連

  • compile "com.google.dagger:dagger:2.8"
  • kapt "com.google.dagger:dagger-compiler:2.8"

解決方法

kotlinのAndroidプロジェクトの場合

各種ライブラリのバージョンを上げることで解決しました。

  • com.android.databinding:compiler2.3.0を指定
  • com.google.dagger:daggerおよびcom.google.dagger:dagger-compiler2.9を指定

通常のAndroidプロジェクトの場合

@teradonburiさんの記事で知りましたが、android-aptがgradle plugin2.3.0以降ではdeprecatedとなっており、aptannotationProcessorに書き直す必要があります。コメントありがとうございました:bow:

また、android-aptのMigrationページのissuesの項目には以下のように書かれていますので、問題が解決するまでandroid-aptを引き続き使用しても良いかもしれません。

if you encounter an issue after migrating it might be a bug in the Android Gradle plugin. Please report these bugs in in the Android bug tracker. You can still revert to android-apt if you are not using Jack in the mean time.

21
9
14

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
21
9