AndroidAnnotation with 2 productFlavors

旧时模样 提交于 2020-01-16 09:58:04

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!