Demetrio Guilardi
Demetrio Guilardi

Reputation: 325

gradle duplicate class error with flavors

Before you classify this as a duplicate thread, the class is NOT duplicated in the main folder.

My files are structured as follows:

- src
  - flavorA.java.com.abc.def
    - Bar.class
  - flavorB.java.com.abc.def
    - Bar.class
  - com.abc
    - Foo.class

Both Bar classes are defined with package com.abc.def. Android studio shows a "Package name does not correspond to the file path" error on flavorA class only. If I change its package to flavorA.java.com.abc.def the error is gone but the Bar class in flavorB folder will be used for both, flavorA and flavorB

my gradle script is configured as follows:

flavorDimensions "free"
productFlavors {
    flavorA {
        dimension "free"
    }
    flavorB {
        dimension "free"
    }
}

PS.: same error with res folders

Upvotes: 1

Views: 242

Answers (1)

Demetrio Guilardi
Demetrio Guilardi

Reputation: 325

Documentation doesn't say it. I solved this issue after adding both flavors to the firebase console panel.

Upvotes: 1

Related Questions