I've got an Android project that includes references to a library project. The library project contains a resource (a renderscript bytecode package). The main project also has it's own resources, including a layout, which contains a field that looks like this:
<EditText android:id="@+id/edit_name" />
When I build my main project in ant, and I call findViewById(R.id.edit_name)
at runtime, the call returns the EditText component I expect. But when I clean the projects and build them in Eclipse findViewById(R.id.edit_name)
returns null
.
Debugging the call shows that my component is present in the View at runtime, and actually has an id assigned, but it's not the same id as the value of R.id.edit_name (in this case, the id in R.java and the runtime value of R.id.edit_name == 0x7f070000, whereas the actual View that exists at runtime has mId == 0x7f080000)
With the ant build, R.java is created with R.id.edit_name === 0x7f080000 (which matches the id I observe when running the app.)
When I remove the library dependency in Eclipse, R.java contains R.id.edit_name == 0x7f070000, but so does the runtime, and everything works just fine.
I realize one good answer is to file a bug report with ADT/Eclipse, and use ant to build, but I'm developing the library and I want to be sure that it supports Eclipse users. So what I'm wondering is:
- Are there known bugs in Eclipse that can cause this sort of thing? Are there known workarounds?
- If not, what is the next debugging step?
Edit:
It turns out this is associated with using a Renderscript asset- when I remove the renderscript, the problem disappears (both projects use the 07 "type" tag in their ids.) I'd still totally love to hear about a workaround, but for now it looks like custom renderscripts in Eclipse built library projects is a non-starter. For reference, I'm using the latest and greatest Eclipse ADT (22.2.1)