问题
I have 2 productFlavors in my project pone and ptwo like below:
flavorDimensions "version"
productFlavors {
pone {
applicationId android.defaultConfig.applicationId
}
ptwo {
applicationId android.defaultConfig.applicationId + “.ptwo”
}
}
sourceSets {
pone {
manifest.srcFile 'app/src/pone/AndroidManifest.xml'
}
ptwo {
manifest.srcFile 'app/src/ptwo/AndroidManifest.xml'
}
}
kapt {
generateStubs = true
arguments {
arg( "resourcePackageName", android.defaultConfig.applicationId)
}
}
Then I have two folders structs: app/src/ptwo/ and app/src/pone/
And in pone and ptwo there is SplashActivity.java and in ptwo there's LoginStoreActivity.java too.
The problem is that when I run ptwo I got
e: error: Could not generate source file for .LoginStoreActivity_ due to error: Illegal name .LoginStoreActivity_
and
e: error: Could not generate source file for .SplashActivity_ due to error: Illegal name .SplashActivity_
The flavor pone runs without erros.
I noticed that the problem is with Android Annotation because when I remove @EActivity
from SplashActivity and LoginStoreActivity there's no error. But I would like to continue using AndroidAnnotation. How could I solve the error above?
回答1:
I finally noticed that my flavorone and flavor two folders are wrongs. It was flavorone->java->SplashActvity.java and LoginStore.java. I was missing the package obviously. My bad :D
Thanks
来源:https://stackoverflow.com/questions/59715835/androidannotation-with-2-productflavors