Use correct variant for annotation processors. am: 878c662602 am: f739144c43
am: aaf8742b38

Change-Id: I96d6b574dfaa8953f79e7f778050b4ef39681656
diff --git a/android/config.go b/android/config.go
index 8330b3d..3a9b98b 100644
--- a/android/config.go
+++ b/android/config.go
@@ -90,8 +90,9 @@
 	ConfigFileName           string
 	ProductVariablesFileName string
 
-	Targets        map[OsClass][]Target
-	BuildOsVariant string
+	Targets              map[OsClass][]Target
+	BuildOsVariant       string
+	BuildOsCommonVariant string
 
 	deviceConfig *deviceConfig
 
@@ -310,6 +311,7 @@
 
 	config.Targets = targets
 	config.BuildOsVariant = targets[Host][0].String()
+	config.BuildOsCommonVariant = getCommonTargets(targets[Host])[0].String()
 
 	if err := config.fromEnv(); err != nil {
 		return Config{}, err
diff --git a/java/java.go b/java/java.go
index 5458ea1..e87a990 100644
--- a/java/java.go
+++ b/java/java.go
@@ -522,8 +522,9 @@
 
 	ctx.AddDependency(ctx.Module(), libTag, j.properties.Libs...)
 	ctx.AddDependency(ctx.Module(), staticLibTag, j.properties.Static_libs...)
-	ctx.AddDependency(ctx.Module(), annoTag, j.properties.Annotation_processors...)
-
+	ctx.AddFarVariationDependencies([]blueprint.Variation{
+		{"arch", ctx.Config().BuildOsCommonVariant},
+	}, annoTag, j.properties.Annotation_processors...)
 	android.ExtractSourcesDeps(ctx, j.properties.Srcs)
 	android.ExtractSourcesDeps(ctx, j.properties.Exclude_srcs)
 	android.ExtractSourcesDeps(ctx, j.properties.Java_resources)