From f6b08547458b9219da1717a79363f778bfc57dd0 Mon Sep 17 00:00:00 2001 From: Deepanshu Gupta Date: Mon, 18 May 2015 14:39:03 -0700 Subject: [PATCH] Show better error message for color attr not found. [DO NOT MERGE] Change-Id: I1ca32989522d30fec336eb607ee81f9e5cb5f48f (cherry picked from commit 5f1bf496948fb6383ae17e5467a26a00489d7564) --- .../com/android/layoutlib/bridge/impl/ResourceHelper.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java index 677c74401e804..a3fde8661e263 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java @@ -16,6 +16,7 @@ package com.android.layoutlib.bridge.impl; +import com.android.SdkConstants; import com.android.annotations.NonNull; import com.android.ide.common.rendering.api.DensityBasedResourceValue; import com.android.ide.common.rendering.api.LayoutLog; @@ -70,6 +71,10 @@ public final class ResourceHelper { public static int getColor(String value) { if (value != null) { if (!value.startsWith("#")) { + if (value.startsWith(SdkConstants.PREFIX_THEME_REF)) { + throw new NumberFormatException(String.format( + "Attribute '%s' not found. Are you using the right theme?", value)); + } throw new NumberFormatException( String.format("Color value '%s' must start with #", value)); }