No known package when getting value for resource number

情到浓时终转凉″ 提交于 2019-12-23 07:44:46

问题


Everything looks like ok. But :

No known package when getting value for resource number 0x7f040001

exception is throwing.


回答1:


My code was:

Resources res = getResources();
InputStream is = res.openRawResource(R.xml.questions);

then I changed it to:

is = getApplicationContext().getResources().openRawResource(R.xml.questions);

Now it works correctly :o

BTW, I had another problem is:

WARN/System.err(577): org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 0: not well-formed (invalid token)

This link solved: Android parsing an xml with saxparser




回答2:


Try:

menu Project -> Clean

If it doesn't runs close project , close eclipse , and repeat...

and a tip , don't touch gen code , it must be only change by eclipse itself.

MOD

sometimes eclipse goes crazy with code . When it happens i usually change code order in res. It happens to me with Strings , eclipse change the string to another one , and bug change when i change the order of some few strings there.



来源:https://stackoverflow.com/questions/7626099/no-known-package-when-getting-value-for-resource-number

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!