明显的合并失败了多个错误,Android

发布于 2025-01-24 04:37:26 字数 1762 浏览 5 评论 0原文

我在我的应用程序

工作管理器版本中使用工作经理实现'androidx.work:work-runtime:2.7.1'

,在清单中,我已经添加

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

并在application tag中添加了清单的应用程序标签。工具:替换=“ android:当局”

获得错误

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)

构建应用程序时,我在清单合并中

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) 

,我看到了此错误,这是我的应用程序类

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

}

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

}

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()

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

讽刺将军 2025-01-31 04:37:26

看起来您使用的是错误的配置:

因为Workmanager 2.6,App启动在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>

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文