Merge cherrypicked r279402 to fix checkbuild.

Change-Id: I903284c842b92ff0c41ba257d654f6c15037bb15
diff --git a/android_webview/Android.mk b/android_webview/Android.mk
index 215dd28..2d1306a 100644
--- a/android_webview/Android.mk
+++ b/android_webview/Android.mk
@@ -13,6 +13,8 @@
 
 LOCAL_MODULE_TAGS := optional
 
+LOCAL_ADDITIONAL_DEPENDENCIES := android_webview_java_with_new_resources
+
 include $(LOCAL_PATH)/java_library_common.mk
 # resource glue layer
 LOCAL_SRC_FILES += \
diff --git a/android_webview/build/res_hack/values/values.xml b/android_webview/build/res_hack/values/values.xml
new file mode 100644
index 0000000..e7f8535
--- /dev/null
+++ b/android_webview/build/res_hack/values/values.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2014 The Chromium Authors. All rights reserved.
+
+     Use of this source code is governed by a BSD-style license that can be
+     found in the LICENSE file.
+-->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android">
+    <!-- Do not put resources here. This file is intentionally empty.
+         It's only to work around a build system issue. -->
+</resources>
diff --git a/android_webview/build/resources_config.mk b/android_webview/build/resources_config.mk
index f9ab135..f32ef6f 100644
--- a/android_webview/build/resources_config.mk
+++ b/android_webview/build/resources_config.mk
@@ -4,8 +4,15 @@
 
 android_webview_manifest_file := $(call my-dir)/AndroidManifest.xml
 
-# resources
+# Resources.
+# The res_hack folder is necessary to defeat a build system "optimization" which
+# ends up skipping running aapt if there are no resource files in any of the
+# resources dirs. Unfortunately, because all of our resources are generated at
+# build time and because this check is performed when processing the Makefile
+# it tests positive when building from clean resulting in a build failure.
+# We defeat the optimization by including an empty values.xml file in the list.
 android_webview_resources_dirs := \
+    $(call my-dir)/res_hack \
     $(call intermediates-dir-for,GYP,shared,,,$(TARGET_2ND_ARCH))/android_webview_jarjar_content_resources/jarjar_res \
     $(call intermediates-dir-for,GYP,shared,,,$(TARGET_2ND_ARCH))/android_webview_jarjar_ui_resources/jarjar_res \
     $(call intermediates-dir-for,GYP,ui_strings_grd,,,$(TARGET_2ND_ARCH))/ui_strings_grd/res_grit \