Android, string resource not found
Solution 1
Sometimes I get this error (once every 2 days), and it's because eclipse is not compiling the new code and it's deploying the old apk. I fix this by
- doing a clean on eclipse (Project -> clean)
- closing the emulator
- restarting the adb server by running
adb kill-server
andadb start-server
from the command line
Solution 2
what i had was
import android.R;
instead of
import com.example.project.R;
android.R does not have your resources it only has the general android resources.
Solution 3
Most likely there's an extra import android.R;
Then your string can't be found there. Otherwise, clean the project and rebuild it, try again, then report back.
Rafael T
Updated on August 27, 2021Comments
-
Rafael T almost 3 years
I'm working on an App, and I am getting weired errors. I put in some String resource in
res/values/strings
and saved it. Now If I want to access it in an Activity I get an error like this07-13 11:16:20.050: ERROR/AndroidRuntime(5883): Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x7f060006
And I can't figure out why. Resource looks like this:
<string name="dialog_download_text">please wait while downloading</string>
and I want to Access it like
public void onCreate(Bundle b){ super.onCreate(b); String s = getResources().getString(R.string.dialog_download_text); }
I also looked into R.java and found my Entry
public static final class string { public static final int dialog_download_cancel=0x7f060005; public static final int dialog_download_text=0x7f060007; public static final int dialog_download_title=0x7f060006; }
I don't know what to do, because I never had a problem like this before. Please help me. Thanks all.