MGK
MGK

Reputation: 7098

How to resolve drawable id conflict?

I have imported .jar into my project . But I am facing a drawable id conflict, I mean trying to laod an image in jar but its loading a image from my projects drawable folder instead of loading it from .jar's drawable folder..Problem is both the drawable's have same id..

Please Help

Upvotes: 1

Views: 580

Answers (1)

inazaruk
inazaruk

Reputation: 74780

You can not load image from jar by resource id. Android build system does not process jar resources in any way, it just embeds them as if they were simple text files. And therefore any image located inside jar is not treated as resources, and con not be accessed via resource ID.

If you need to access drawables from library, consider using Android Library instead.

Documentation on how to setup library project can be found here. More details on what is different between jars and Android Libraries can be found in my post Android Application, Android Libraries and Jar Libraries.

Upvotes: 2

Related Questions