5

我刚刚开始使用新的Android Jack 编译器并使用 Greenrobot Eventbus
经过一些反复试验后,我让它工作了,但它似乎只有在我eventBusIndex在 2 个地方指定参数时才有效 - 请参见下面的代码:

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
        ]
    }
}
4

0 回答 0