diff --git a/java/src/com/android/inputmethod/keyboard/internal/MoreKeySpecParser.java b/java/src/com/android/inputmethod/keyboard/internal/MoreKeySpecParser.java
index e6b6db4235df1ee70cefb4fdbe9cf12f29bca516..d4c85c33d048fdc2d440ff7960b5051e34876657 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/MoreKeySpecParser.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/MoreKeySpecParser.java
@@ -22,6 +22,7 @@ import android.util.Log;
 
 import com.android.inputmethod.keyboard.Keyboard;
 import com.android.inputmethod.latin.R;
+import com.android.inputmethod.latin.Utils;
 
 import java.util.ArrayList;
 
@@ -150,8 +151,9 @@ public class MoreKeySpecParser {
             if (indexOfLabelEnd(moreKeySpec, end + 1) >= 0) {
                 throw new MoreKeySpecParserError("Multiple " + LABEL_END + ": " + moreKeySpec);
             }
-            final int resId = getResourceId(res,
-                    moreKeySpec.substring(end + LABEL_END.length() + PREFIX_AT.length()));
+            final int resId = Utils.getResourceId(res,
+                    moreKeySpec.substring(end + LABEL_END.length() + PREFIX_AT.length()),
+                    R.string.english_ime_name);
             final int code = res.getInteger(resId);
             return code;
         }
@@ -180,15 +182,6 @@ public class MoreKeySpecParser {
         return KeyboardIconsSet.ICON_UNDEFINED;
     }
 
-    private static int getResourceId(Resources res, String name) {
-        String packageName = res.getResourcePackageName(R.string.english_ime_name);
-        int resId = res.getIdentifier(name, null, packageName);
-        if (resId == 0) {
-            throw new MoreKeySpecParserError("Unknown resource: " + name);
-        }
-        return resId;
-    }
-
     @SuppressWarnings("serial")
     public static class MoreKeySpecParserError extends RuntimeException {
         public MoreKeySpecParserError(String message) {
diff --git a/java/src/com/android/inputmethod/latin/Utils.java b/java/src/com/android/inputmethod/latin/Utils.java
index 8e0cfa12218b4976261fb537ed40f41324898fb6..d8ca409c73f9add2dd0d4851bce7a6630e7bea21 100644
--- a/java/src/com/android/inputmethod/latin/Utils.java
+++ b/java/src/com/android/inputmethod/latin/Utils.java
@@ -16,14 +16,6 @@
 
 package com.android.inputmethod.latin;
 
-import com.android.inputmethod.compat.InputMethodInfoCompatWrapper;
-import com.android.inputmethod.compat.InputMethodManagerCompatWrapper;
-import com.android.inputmethod.compat.InputMethodSubtypeCompatWrapper;
-import com.android.inputmethod.compat.InputTypeCompatUtils;
-import com.android.inputmethod.keyboard.Keyboard;
-import com.android.inputmethod.keyboard.KeyboardId;
-import com.android.inputmethod.latin.define.JniLibName;
-
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.PackageManager;
@@ -41,6 +33,14 @@ import android.text.format.DateUtils;
 import android.util.Log;
 import android.view.inputmethod.EditorInfo;
 
+import com.android.inputmethod.compat.InputMethodInfoCompatWrapper;
+import com.android.inputmethod.compat.InputMethodManagerCompatWrapper;
+import com.android.inputmethod.compat.InputMethodSubtypeCompatWrapper;
+import com.android.inputmethod.compat.InputTypeCompatUtils;
+import com.android.inputmethod.keyboard.Keyboard;
+import com.android.inputmethod.keyboard.KeyboardId;
+import com.android.inputmethod.latin.define.JniLibName;
+
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
@@ -793,4 +793,13 @@ public class Utils {
             LatinImeLogger.logOnAutoCorrectionCancelled();
         }
     }
+
+    public static int getResourceId(Resources res, String name, int packageNameResId) {
+        String packageName = res.getResourcePackageName(packageNameResId);
+        int resId = res.getIdentifier(name, null, packageName);
+        if (resId == 0) {
+            throw new RuntimeException("Unknown resource: " + name);
+        }
+        return resId;
+    }
 }
diff --git a/tests/src/com/android/inputmethod/keyboard/internal/MoreKeySpecParserTests.java b/tests/src/com/android/inputmethod/keyboard/internal/MoreKeySpecParserTests.java
index edccff33aa3adf42f8c5d1027982d26a970d54e6..ea11ff73df5cbc4ca7bafef045ddf024767f5714 100644
--- a/tests/src/com/android/inputmethod/keyboard/internal/MoreKeySpecParserTests.java
+++ b/tests/src/com/android/inputmethod/keyboard/internal/MoreKeySpecParserTests.java
@@ -66,7 +66,7 @@ public class MoreKeySpecParserTests extends AndroidTestCase {
             assertParser(message, moreKeySpec, expectedLabel, expectedOutputText, expectedIcon,
                     expectedCode);
             fail(message);
-        } catch (MoreKeySpecParser.MoreKeySpecParserError pcpe) {
+        } catch (Exception pcpe) {
             // success.
         }
     }