Reputation: 1098
I have one main module and two library modules, libA
and libB
.
In libA
, string.xml
has a param with name param1
is equal SampleText1
and
in libB
, string.xml
param1
is equal SampleText2
.
libA
and libB
have been added into the main module as library
dependencies {
compile project(':libB')
compile project(':libA')
}
Finally, on the main module param1
equals SampleText1
, but I want param1
to be equal SampleText2
.
I have changed the library order on dependencies
, but it doesn't have any effect.
Is there any way to change an resources overriding order?
Upvotes: 3
Views: 1695
Reputation: 1098
I have solved this task with changing my flavor name with alphabetic order. In result first letter of root module should be before others flavors name in asc order. This isn't misunderstanding but it works for me.
Upvotes: 1
Reputation: 191725
My package names are uniqiue in both libs
Good, then nothing needs overriding, you simply need to reference the resource correctly using this format.
@[<package_name>:]<resource_type>/<resource_name>
So this
@string/param1
Becomes this
@com.example.lib1:string/param1
More details at Accessing Resources
Upvotes: 1