Duplicate classes R & BuildConfig after “Reimport All Maven Projects”

后端 未结 3 944
情话喂你
情话喂你 2021-01-18 07:11

We are building our Android projects with Maven and IntelliJ IDEA. Sometimes we must execute \"Reimport All Maven Projects\", e.g. to update dependencies. The problem with t

3条回答
  •  北海茫月
    2021-01-18 07:40

    After IDEA detects and adds Android facet to module, it would start generating gen folder at usual place, but maven-android-plugin generates its own under target directory.

    You need to tell IDEA to place generated files at same place where maven-android-plugin creates them.

    First, use module's android facet settings and check the option to use Maven goal instead of generating by itself:

    enter image description here

    Then, go to module's settings and set output path same as Maven's, which is target directory:

    enter image description here

    Delete gen directories, Do mvn clean to clear all unnecessary files.

提交回复
热议问题