I have problem with my Android Studio Instant App Project.
If I select Manifest.xml
in /app directory then select Merger Manifest then I have such error:
Merging Errors: Error: Attribute provider#android.arch.lifecycle.ProcessLifecycleOwnerInitializer@authorities value=(com.theminte.TheMinte.lifecycle-trojan) from AndroidManifest.xml:10:15-75 is also present at AndroidManifest.xml:25:13-68 value=(com.theminte.TheMinte.app.lifecycle-trojan). Suggestion: add 'tools:replace="android:authorities"' to <provider> element at AndroidManifest.xml:10:5-201 to override. app main manifest (this file), line 9
Than I cannot start my application with Default Activity, I can only start it with Nothing Activity selected in Project Build Configuration. How to solve this merging issue?
Try adding the following labels to resolve the issue: Add the xmlns:tools line in the manifest tag. Add tools:replace= or tools:ignore= in the application tag.
So when building your app, the Gradle build merges all manifest files into a single manifest file that's packaged into your app. The manifest merger tool combines all XML elements from each file by following some merge heuristics and by obeying merge preferences that you have defined with special XML attributes.
Every project in Android includes a Manifest XML file, which is AndroidManifest. xml, located in the root directory of its project hierarchy. The manifest file is an important part of our app because it defines the structure and metadata of our application, its components, and its requirements.
The AndroidManifest. xml file contains information of your package, including components of the application such as activities, services, broadcast receivers, content providers etc.
I was able to fix this by changing the <manifest package = ${package}
in my base module's manifest.xml
to match the project's applicationId
.
It appears that androidx.lifecycle:lifecycle-process:2.0.0
, a dependency of androidx.lifecycle:lifecycle-extensions:2.0.0
, is injecting the provider into base module's manifest with the package defined in the manifest.xml. Per the provider code in lifecycle-extensions/manifest.xml
, it looks like it's expected to be the applicationId
defined in build.gradle
. The provider xml is:
<provider
android:name="androidx.lifecycle.ProcessLifecycleOwnerInitializer"
android:authorities="${applicationId}.lifecycle-process"
android:exported="false"
android:multiprocess="true" />
The merged manifest in my base module was showing the above provider inserted with an android:authorities
value matching the <manifest package:{package}
in the base module's manifest.xml
instead of the packageId
from app/build.gradle
.
In the application module I see the provider being injected with the applicationId listed in the application build.gradle
. This creates a conflict since there are now two providers with the same android:name="androidx.lifecycle.ProcessLifecycleOwnerInitializer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With