0

I tried adding dagger to my project by adding implementation "com.google.dagger:dagger:$rootProject.dagger2Version" (based on answer of Liubomyr Protsyk in: this question)

in build.gradle and It resulted with "Could not get unknown property 'dagger2Version' for root project ..." which I understand, what I cannot understand is why after removing that line I cannot sync gradle project... Every try to use "try again" enter image description here

results in:

Caused by: java.lang.IllegalArgumentException: Cannot convert string value 'UNIFIED_TEST_PLATFORM' to an enum value of type 'com.android.builder.model.AndroidGradlePluginProjectFlags$BooleanFlag' (valid case insensitive values: APPLICATION_R_CLASS_CONSTANT_IDS, TEST_R_CLASS_CONSTANT_IDS, TRANSITIVE_R_CLASS, JETPACK_COMPOSE, ML_MODEL_BINDING)

any ideas how to fix that? I honestly have no clue, so any help will be appreciated.

JustSightseeing
  • 1,460
  • 3
  • 17
  • 37
  • Check out: Github - https://github.com/google/dagger Maven - https://search.maven.org/search?q=g:com.google.dagger – Brandon Dec 31 '21 at 17:31

2 Answers2

2

In case anyone has the same error, you need to update Android Studio to the latest version

Gabriel
  • 146
  • 1
  • 2
  • 10
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 02 '22 at 09:07
0

Defining dagger2Version as extras before trying to access it may help:

project.ext.set('dagger2Version', '2.40.5')

And the getter also seems to be wrong:

rootProject.ext.get('dagger2Version')
Martin Zeitler
  • 1
  • 19
  • 155
  • 216