如何将'eventBusIndex'参数传递给EventBus注释处理器

时间:2016-09-30 15:47:37

标签: android-gradle android-jack-and-jill greenrobot-eventbus-3.0

我刚刚开始使用新的Android Jack compiler并使用Greenrobot Eventbus 我在一些反复试验之后才开始工作,但是当我在2个地方指定eventBusIndex参数时它似乎才有效 - 请参阅下面的代码:

android {
    defaultConfig {
        javaCompileOptions {
            annotationProcessorOptions {
                // TODO: why must I specify eventBusIndex twice? --> also for each buildVariant
                arguments = [
                  'eventBusIndex': "com.tmtron.dscontrol.EventBusIndex"
                ]
            }
        }
    }
    // this is a workaround to specify the Manifest for AndroidAnnotations
    // see: https://code.google.com/p/android/issues/detail?id=210753
    applicationVariants.all { variant ->
        variant.variantData.variantConfiguration.javaCompileOptions.annotationProcessorOptions
                .arguments = [
                      'eventBusIndex': "com.tmtron.dscontrol.EventBusIndex"
                    , 'androidManifestFile': variant.outputs[0]?.processResources?.manifestFile?.absolutePath
        ]
    }
}

0 个答案:

没有答案