When I create an Android library, by default it would give me the below in the Manifest file
<application android:allowBackup="true"
android:label="@string/app_name"
android:supportsRtl="true"/>
After post it as a library on Bintray and used by others, just realise if an application that include this library has the below in its Manifest
android:supportsRtl="false"
It will post the error as below during gradle sync or compilation.
Error:Execution failed for task ':app:processProductionDebugManifest'.
> Manifest merger failed : Attribute application@supportsRtl value=(false) from AndroidManifest.xml:23:9-36
is also present at [com.mylibrarypackage:mylibrary:1.0.0] AndroidManifest.xml:14:9-35 value=(true).
Suggestion: add 'tools:replace="android:supportsRtl"' to <application> element at AndroidManifest.xml:18:5-67:19 to override.
To fix it, I think I would need to remove the android:supportsRtl="true"
from my library Manifest.
Just wonder why did Android have this as default its library manifest? Would there be any potential problem if I remove android:supportsRtl="true"
from my library Manifest?
tools:replace=”x, y”
Replace the x, y attributes from any lower priority declaration with
the provided value (must be present on the same node).
When importing a library with a lower target SDK than the project’s, it may be necessary to explicitly grant permissions (and perhaps make other changes) for the library to function properly in the later runtime. This will be performed automatically by the manifest merger.
You are getting
Manifest merger failed : Attribute application@supportsRtl
value=(false) from AndroidManifest.xml:23:9-36
You can add
tools:replace="android:supportsRtl"
Finally
<application android:allowBackup="true"
android:label="@string/app_name"
android:supportsRtl="true"
tools:replace="android:supportsRtl"/>
It is required if you want to support right-to-left (RTL) layouts.
If set to true and targetSdkVersion is set to 17 or higher, various RTL APIs will be activated and used by the system so your app can display RTL layouts. If set to false or if targetSdkVersion is set to 16 or lower, the RTL APIs will be ignored or will have no effect and your app will behave the same regardless of the layout direction associated to the user's Locale choice (your layouts will always be left-to-right).
The default value of this attribute is false.
This attribute was added in API level 17.
(Source: http://developer.android.com/guide/topics/manifest/application-element.html)