0

I am building a developer tools SDK as an Android Library Project. I would like to have the host app developer configure my SDK not in code, but in an XML file. I looked into putting some configuration strings in the manifest, but that is not secure. So I would like to have the host developer define some strings in the host app. The trouble is, it doesn't appear that my library project can see the strings defined in the host app. I can't reference resource ids that are defined in the host project from my library project during compilation, even though they are merged together and stuck in the same DEX.

Is there any way to read resources defined in the host project, from a library project?

Sky Kelsey
  • 19,192
  • 5
  • 36
  • 77
  • I've just understood you. [This answer](http://stackoverflow.com/a/3441986/1521536) will help you, in the opposite way. I mean you shouldn't do that (your way) with library project. The host project should provide all things to library project. Library project shouldn't interact with the host project. –  Jul 30 '12 at 17:37

1 Answers1

0

OK, it looks like you can just define a resource with the same name in both your library project, and in your host app project. This will allow compilation to proceed, and the host app resource will override the library project resource.

Sky Kelsey
  • 19,192
  • 5
  • 36
  • 77
  • There is an [issue](http://code.google.com/p/android/issues/detail?id=30622) related to your question. –  Jul 28 '12 at 16:26
  • Interesting. It looks like which layout file is chosen is random. Another way to pass data in is to define it as meta-data in the AndroidManifest.xml, so that is what I will do. – Sky Kelsey Jul 30 '12 at 16:19