How do I resolve a “'generateDebugSources' not found in project” error?

前端 未结 8 1300
囚心锁ツ
囚心锁ツ 2021-02-07 07:36

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

8条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-07 08:00

    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:

    1. include :app - Add or remove this from your project gradle file and do a rebuild.
    2. gradle init - Running this from the terminal helped.

提交回复
热议问题