Inspectopedia Help

Hardcoded reference to /sdcard

Hardcoded reference to /sdcard

Your code should not reference the /sdcard path directly; instead use Environment.getExternalStorageDirectory().getPath().

Similarly, do not reference the /data/data/ path directly; it can vary in multi-user scenarios. Instead, use Context.getFilesDir().getPath().

Issue id: SdCardPath

https://developer.android.com/training/data-storage#filesExternal

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for Android 2023.3, Qodana for JVM 2023.3

Plugin:

Android, 2022.3.1 Beta 2

Last modified: 13 July 2023