Incorrect argument counting, format string [name] requires 0, but formats supplies 1

I just can’t understand why I am getting this error, I am doing the same thing in another class and it works fine (maybe this is import?)

I want to do this:

SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
String downloadKey = getString(R.string.pref_download_folder_key); // This will return "pref_download_folder"
String downloadDefault = getString(R.string.pref_download_folder_default);
DownloadFolder = sharedPref.getString(downloadKey, downloadDefault);

But I get the following error:

Incorrect argument counting, pref_download_folder format string requires 0, but formats supplies 1

When I change the line to this, everything works fine (note that downloadDefault works despite the same method):

DownloadFolder = sharedPref.getString("pref_download_folder", downloadDefault);

Thanks in advance!

+4
source share
1 answer

This is an Android Studio bug. http://code.google.com/p/android/issues/detail?id=53238

"" .

gradlew assembleDebug

gradlew assembleRelease

.

: , , Android Studio, , .

+6

Source: https://habr.com/ru/post/1531723/


All Articles