简体   繁体   中英

Manifest merger failed with multiple errors , android

I am using work manager in my application

Work manager version implementation 'androidx.work:work-runtime:2.7.1'

And in the manifest I have added

<provider
        android:name="androidx.startup.InitializationProvider"
        android:authorities="${applicationId}.workmanager-init"
        tools:node="remove" />

And added this at application tag in manifest tools:replace="android:authorities"

When I build the application I get the error

Caused by: java.lang.RuntimeException: Manifest merger failed with multiple errors, see logs
at com.android.build.gradle.internal.tasks.manifest.ManifestHelperKt.mergeManifests(ManifestHelper.kt:87)
at com.android.build.gradle.tasks.ProcessApplicationManifest.doFullTaskAction(ProcessApplicationManifest.kt:144)
at com.android.build.gradle.internal.tasks.IncrementalTask.handleIncrementalInputs(IncrementalTask.kt:112)
at com.android.build.gradle.internal.tasks.IncrementalTask.access$handleIncrementalInputs(IncrementalTask.kt:65)
at com.android.build.gradle.internal.tasks.IncrementalTask$taskAction$$inlined$recordTaskAction$1.invoke(BaseTask.kt:65)
at com.android.build.gradle.internal.tasks.Blocks.recordSpan(Blocks.java:51)

In the manifest merge I see this error

Merging Errors: Error: tools:replace specified at line:6 for attribute android:authorities, but no new value specified My_Application.app main manifest (this file), line 5 Error: Validation failed, exiting My_Application.app main manifest (this file) 

And this is my application class

class App : Application(), Configuration.Provider {
override fun onCreate() {
    super.onCreate()

}

override fun getWorkManagerConfiguration(): Configuration =
    Configuration.Builder()
        .setMinimumLoggingLevel(android.util.Log.DEBUG)
        .build()

}

It looks like you are using the wrong config:

Since WorkManager 2.6, App Startup is used internally within WorkManager. To provide a custom initializer you need to remove the androidx.startup node.

<!-- If you want to disable android.startup completely. -->
 <provider
    android:name="androidx.startup.InitializationProvider"
    android:authorities="${applicationId}.androidx-startup"
    tools:node="remove">
 </provider>

https://developer.android.com/topic/libraries/architecture/workmanager/advanced/custom-configuration#remove-default

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM