工具:替换在第 19 行为属性 android:appComponentFactory 指定的替换,但没有指定应用程序主清单的新值 [英] tools:replace specified at line:19 for attribute android:appComponentFactory, but no new value specified app main manifest

查看:42
本文介绍了工具:替换在第 19 行为属性 android:appComponentFactory 指定的替换,但没有指定应用程序主清单的新值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编译 6 个月前的代码,但出现此错误:

I am trying to compile a 6 months old code, but I get this error:

tools:replace 在第 19 行为属性 android:appComponentFactory 指定,但没有指定新值应用主清单(此文件),第 18 行错误:验证失败,退出应用主清单(此文件)

为了解决这个问题,我在 AndroidManifest.xml

To fix this issue, I added the following line in my AndroidManifest.xml

tools:replace="android:appComponentFactory"

但现在我收到了这个错误:

But now I got this error:

Manifest 合并失败,出现多个错误,查看日志

当我用谷歌搜索这个错误时,它要求我从我在第一步添加的 AndroidManifest.xml 中删除该行.所以,这是一种循环.我怎样才能摆脱这个.

When I googles this error, it asks me to remove that line from AndroidManifest.xml that I added in first step. So, it's kind of a loop. How can I get rid of this.

我的依赖:

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
implementation files('libs/apache-mime4j-0.6 2.jar')
implementation files('libs/httpmime-4.0.1 .jar')
// this line must be included to integrate with Firebase
implementation 'com.hbb20:ccp:2.0.1'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.1.17'
implementation 'com.github.mukeshsolanki:country-picker-android:1.1.9'
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.google.android.gms:play-services:10.2.1'
implementation 'com.google.maps.android:android-maps-utils:0.4'
implementation 'com.google.android.gms:play-services-location:10.2.1'
implementation 'com.google.code.gson:gson:2.4'
implementation 'com.airbnb.android:airmapview:1.3.0'
implementation 'com.mcxiaoke.volley:library:1.0.19'
implementation 'com.github.jd-alexander:library:1.1.0'
implementation 'com.jakewharton:butterknife:10.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.android.gms:play-services-maps:10.2.1'
implementation 'com.google.android.gms:play-services-wallet:10.2.1'
implementation 'com.stripe:stripe-android:4.1.5'
implementation 'com.stripe:stripe-java:1.47.0'
implementation 'com.squareup.picasso:picasso:2.4.0'
implementation 'com.android.support:multidex:1.0.1'
implementation 'com.google.firebase:firebase-core:10.2.1'
implementation 'com.google.firebase:firebase-messaging:10.2.1'
implementation 'com.google.firebase:firebase-database:10.2.1'
implementation 'com.github.barteksc:android-pdf-viewer:2.0.3'
testImplementation 'junit:junit:4.12'
debugImplementation 'com.amitshekhar.android:debug-db:1.0.1'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:mediarouter-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'

}

推荐答案

您的项目中的另一个清单文件似乎遇到了合并问题.许多元素名称可以在清单中多次出现,例如多个 元素.其中许多都有一个标识符,通常是 android:name,用于区分一个和下一个.一般来说,如果两个清单源都贡献相同的元素(即相同的元素名称,相同的 android:name 值),则这两个元素本身会合并,这意味着:

Seems like you are having merger issues from another manifest file in your project. Many element names can appear several times in a manifest, such as multiple <uses-permission> elements. Many of those have an identifier, usually android:name, that distinguishes one from the next. In general, if two manifest sources both contribute the same element (i.e., same element name, same android:name value), those two elements are themselves merged, which means:

  • 任何属于一个但不属于另一个的属性都会添加到组合元素中.
  • 任何属性在两者中且值不相同,都会导致合并冲突编译错误,除非通过标记指定解决方案
  • 应用相同的规则合并所有子元素(例如,在 内部).

有时,默认的合并规则不会令您满意.特别是,当存在冲突时,构建将失败,这可能不是预期的结果.要在发生冲突时声明谁获胜,您可以在清单元素中使用 tools:* 属性.具体:

Sometimes, the default merger rules will not work to your satisfaction. In particular, when there are conflicts, the build will fail, and probably that is not a desired outcome. To declare who wins in the case of conflicts, you can use tools:* attributes in the manifest elements. Specifically:

  • tools:node 指示如何解决此特定 XML 元素的两个版本之间的冲突(例如,一个用于相同的 android:name)
  • tools:replace 表示来自较低优先级清单版本的某些属性应该被来自较高优先级清单版本的替换值覆盖
  • tools:remove 表示应完全删除清单的低优先级版本中的某些属性
  • tools:node indicates how to resolve a conflicts between two editions of this particular XML element (e.g., an for the same android:name)
  • tools:replace indicates that certain attributes from a lower-priority edition of the manifest should be overwritten by their replacement values from a higher-priority edition of the manifest
  • tools:remove indicates that certain attributes from a lower-priority edition of the manifest should be removed entirely

这些都在 tools 命名空间中,将要求您在根元素上具有 xmlns:tools="http://schemas.android.com/tools",如果它是已经没有了.除了构建工具如何根据工具属性构建您的应用之外,这些属性仅影响构建工具,没有运行时影响.

Each of these, being in the tools namespace, will require you to have xmlns:tools="http://schemas.android.com/tools" on the root element, if it is not there already. These attributes only affect the build tools and have no runtime implications, other than in terms of how the build tools build your app based on the tools attributes.

这篇关于工具:替换在第 19 行为属性 android:appComponentFactory 指定的替换,但没有指定应用程序主清单的新值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆