I was trying to add a dependency to my application and I accidentally modified the wrong build.gradle file and now my application no longer builds correctly.
This is my
Chris Deligan got it partially right.
Basically, you need to resolve the gradle dependencies so that Android Studio can correctly recognize that a generateDebugSources
task does indeed exist in your :app
(For me it was the other way around - I needed Android Studio to recognize that generateDebugSources
does not exist).
Doing an include ':app'
did resolve the problem for me, but that's because gradle wasn't resolving the dependencies earlier properly for me. Doing an include ':app'
and rebuilding the project helped because Studio rebuilt those dependencies properly because of it. (Oh and removing it helps as well)
========================================================================
IN Brief -
Do something that re-generates the dependencies. Ways to do that are:
include :app
- Add or remove this from your project gradle file and do a rebuild.gradle init
- Running this from the terminal helped.