I've got a project, structured like this:
project/
|
|---src/
|---flavorA2/
| |
| |---java/
| | |---com.abc.flavorA.mk2
| | |-----classA.java
| | |-----classB.java
| |---res/
| |---AndroidManifest.xml
|
|---main
| |---java/
| | |---com.abc.flavorA
| | |-----classA.java
| | |-----classB.java
| | |-----classC.java
| | |-----classD.java
| |---res/
| | |---drawable/
| | |---layout/
| | |---values/
| |
| |---AndroidManifest.xml
|
|---flavorA
flavorA
will use the source and assets from main
completely while flavorA2
has some small changes in classA
and classB
and the package name is also changed to com.abc.flavorA.mk2
.
I had the build.gradle
file like this:
...
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors {
flavorA2 {
packageName "com.abc.flavorA.mk2"
versionCode 2
versionName "1.0.1"
}
flavorA {
packageName "com.abc.flavorA"
}
}
...
I run the code by selecting the build variant to flavorA2
. However the running results shows that the gradle still choose the classes (classA
and classB
) from main
instead of using the changed version inside flavorA2
.
Am I missing something here?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…