问题
imagine some proyect like this one that use android-annotations and for this work i have to put this in build.gradle
apt {
arguments {
resourcePackageName "com.pandaos.smartconfig"
androidManifestFile variant.outputs[0].processResources.manifestFile
}
}
where: resourcePackageName "com.pandaos.smartconfig"
its the path where code its annotated... the config for plugin android-apt
apply plugin: 'com.neenbedankt.android-apt'
I suppose, that plugin "invoke" some task to generate the code that android-annotations create under the hood, but...
Its possible define multiple "packages in the app"?
回答1:
The resourcePackageName
comes from the configuration option for AndroidAnnotations as mentioned here:
By default, AndroidAnnotations try to find the
R
class by extracting application package fromAndroidManifest.xml
file. But in some cases you may want to specify a custom package to look for the R class. This is why we addedresourcePackageName
option.
There are two things to note:
The option refers to the Android package name, which does not have to be the same as your java package name.
The
R
package name can be different from the Android package name you set inAndroidManifest.xml
if you use the applicationId option in the Gradle build file.
It's totally fine to have a different java package name in your code. AFAIK this will not influence AndroidAnnotations in any way.
The apt
block is provided by the android-apt
plugin and allows you to configure any parameter to annotation processors in your project. In this case it configures the parameters that AndroidAnnotations need to do its job. The android-apt
plugin serves two purposes in this case: it configures the parameters for the AndroidAnnotations processor, and it will make sure you can reference the sources that are generated by AA in Android Studio.
来源:https://stackoverflow.com/questions/31536234/android-annotations-multiple-paths-to-apt