diff --git a/pmd/etc/changelog.txt b/pmd/etc/changelog.txt
index b10df48bec..c672f7b066 100644
--- a/pmd/etc/changelog.txt
+++ b/pmd/etc/changelog.txt
@@ -13,6 +13,7 @@ Dependencies updates: asm updated to 3.2
Android ruleset: CallSuperLast rule now also checks for finish() redefinitions
New rule:
+ Android: DoNotHardCodeSDCard
Controversial : AvoidLiteralsInIfCondition (patch 2591627)
StrictExceptions : AvoidCatchingGenericException
diff --git a/pmd/regress/test/net/sourceforge/pmd/rules/android/AndroidRulesTest.java b/pmd/regress/test/net/sourceforge/pmd/rules/android/AndroidRulesTest.java
index c08a4d189c..feb896b955 100644
--- a/pmd/regress/test/net/sourceforge/pmd/rules/android/AndroidRulesTest.java
+++ b/pmd/regress/test/net/sourceforge/pmd/rules/android/AndroidRulesTest.java
@@ -10,6 +10,7 @@ public class AndroidRulesTest extends SimpleAggregatorTst {
public void setUp() {
addRule("android", "CallSuperFirst");
addRule("android", "CallSuperLast");
+ addRule("android", "DoNotHardCodeSDCard");
addRule("android", "ProtectLogD");
addRule("android", "ProtectLogV");
}
diff --git a/pmd/regress/test/net/sourceforge/pmd/rules/android/xml/DoNotHardCodeSDCard.xml b/pmd/regress/test/net/sourceforge/pmd/rules/android/xml/DoNotHardCodeSDCard.xml
new file mode 100644
index 0000000000..596362b7ac
--- /dev/null
+++ b/pmd/regress/test/net/sourceforge/pmd/rules/android/xml/DoNotHardCodeSDCard.xml
@@ -0,0 +1,19 @@
+
+
+
+ basic /sdcard test
+ 1
+
+
+
+
\ No newline at end of file
diff --git a/pmd/rulesets/android.xml b/pmd/rulesets/android.xml
index 5e3c70ad3b..9d8523d4df 100644
--- a/pmd/rulesets/android.xml
+++ b/pmd/rulesets/android.xml
@@ -169,5 +169,28 @@ To get better results, make sure that the auxclasspath is defined for type resol
+
+ Use Environment.getExternalStorageDirectory() instead of "/sdcard"
+ 3
+
+
+ //Literal[starts-with(@Image,'"/sdcard')]
+
+
+
+
+
+