android - What EXACTLY does Resources$NotFoundException mean? -
i posted resources$notfoundexception bug here , got usual generic suggestions deleting "gen" folder, doing clean, doing refresh, etc, etc. there hundreds (thousands?) of other programmers getting same exception , getting same suggestions on s.o. , web. can't seem find anyplace describes error means.
the documentation vague: http://developer.android.com/reference/android/content/res/resources.notfoundexception.html
resources$notfoundexception runtime error presumably it's looking in apk file.
- how resources built apk file @ build-time? start xml file , what...?
- how referenced @ runtime?
- what relationship between resource id see in debugger , how it's identified in apk file?
- what (windows) tools can use examine apk file find these resource myself?
thanks in advance answers of these questions!
ps - if think have answer original bug please post there , not thread; different question.
- resource can packaged in various ways raw assets, optimized images packaged byte data. zipped 1 apk. - idof resource helps finding back. during development, build tool (- aapt) continually scan- resdirectory xml, images etc , generate numeric constants in- r.java. read detail android's build process.
- at runtime - resourcesinstance decides for, depending on whether of method called. numeric- idhelps query resource mapping , find correct one. actual data loading handled native low-level code.
- debugger can show objects , fields. find out missing read error message - notfoundexceptiontraces in logcat. lists hex value of resource id.
- apktool lets deflate - apkfile , re-construct- resdirectory.
update:
how resources packaged:
if have apk , want see full resource table run aapt tool in sdk as:
 aapt list -v myapp.apk it show details as:
archive:  ./myapp.apk  length   method    size  ratio   offset      date  time  crc-32    name --------  ------  ------- -----  -------      ----  ----  ------    ----      468  deflate     228  51%         0  11-07-12 23:25  29fb0660  res/color/abs__primary_text_disable_only_holo_dark.xml      468  deflate     228  51%       332  11-07-12 23:25  bae4791a  res/color/abs__primary_text_disable_only_holo_light.xml     2942  stored     2942   0%    280417  10-27-12 16:52  9b5af43b  res/drawable-xhdpi/ic_mus.png     2330  stored     2330   0%    283418  10-27-12 16:52  21f5ba4d  res/drawable-xhdpi/ic_pic.png     1556  stored     1556   0%    285810  10-27-12 16:52  31c3402b  res/drawable-xhdpi/ic_vid.png you see method (deflate,stored etc) , offset in binary data resource stored, , length, denotes how many bytes read after offset resource.
what resources.notfoundexception prints:
here's code generates it:
public void getvalue(int id, typedvalue outvalue, boolean resolverefs)         throws notfoundexception {     boolean found = massets.getresourcevalue(id, 0, outvalue, resolverefs);     if (found) {         return;     }     throw new notfoundexception("resource id #0x"                                 + integer.tohexstring(id)); } thus, prints hex value of id resources instance requested load. 
here's part of r.java:
public static int absforceoverflow=0x7f010039; you can see id assigned similar hex values.
can solve error?
the error should not have occurred @ first place if build tools compiled project successfully. there's not can except cleaning or rebuilding project. represents bug in build tools or resource loader.
Comments
Post a Comment