Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is `android:supportsRtl="true"` in the Library Manifest essential? It is causing error sometimes

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?

like image 729
Elye Avatar asked Aug 27 '16 06:08

Elye


People also ask

What is supportsRtl manifest Android?

android:supportsRtl="true" enables support for right-to-left languages. Without this, layout will always be left-to-right, However by itself it does not change the layout to be from right to left. It simply enables other attributes - one of those new attributes controls whether is left-to-right or right-to-left.

What is Android manifest XML file and why do you need this?

Every app project must have an AndroidManifest. xml file (with precisely that name) at the root of the project source set. The manifest file describes essential information about your app to the Android build tools, the Android operating system, and Google Play.

What is an Android manifest and what is it for?

The Android manifest file helps to declare the permissions that an app must have to access data from other apps. The Android manifest file also specifies the app's package name that helps the Android SDK while building the app.

What is manifest example in Android?

The AndroidManifest. xml file contains information of your package, including components of the application such as activities, services, broadcast receivers, content providers etc.


1 Answers

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"/>
like image 150
IntelliJ Amiya Avatar answered Oct 07 '22 11:10

IntelliJ Amiya