2

I have a project with some layouts and I'm linking to it from another project which also has its own layouts. The problem is that it causes duplicate identifiers, so when I'm trying to inflate a layout from one of the projects, I'm getting the layout with the same identifier from the other project. How can I settle this issue? Thanks.

user940016
  • 2,878
  • 7
  • 35
  • 56

2 Answers2

3

Try using full paths like com.my.first.package.name.R.layout.sameId and com.my.second.package.name.R.layout.sameId

vasart
  • 6,692
  • 38
  • 39
  • To add note to this, by default you will use the highest level resource file by default, so you should only need to explicitly define library package names – Chris.Jenkins Nov 02 '12 at 10:53
  • Tried it, same error. I actually don't think it matters if I add the package name or not, because it still translates to the same identifier. – user940016 Nov 02 '12 at 11:18
  • Then try creating file `values/ids.xml` like described here http://developer.android.com/guide/topics/resources/more-resources.html#Id – vasart Nov 02 '12 at 11:49
  • I don't understand how this can solve the issue. The layouts get their ids automatically. This file is only for widgets ids. – user940016 Nov 02 '12 at 12:06
0

It should not be a problem using someother identifiers in your layout as far you do not have two resources with the same id in the same inflatable resource or share the same root view.

That's like using @android:id/text1 ids in your layouts.

If that's a problem, why not just rename your own ids?

rgrocha
  • 1,461
  • 10
  • 19