Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/195.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android studio渐变图标错误,清单合并_Android_Gradle_Android Studio - Fatal编程技术网

Android studio渐变图标错误,清单合并

Android studio渐变图标错误,清单合并,android,gradle,android-studio,Android,Gradle,Android Studio,我一直看到这条信息,不知道如何永远解决它 Error:(43, 9) Attribute application@icon value=(@drawable/new_app_icon) from AndroidManifest.xml:43:9 is also present at com.github.erizet.signala:signala-longpolling:0.20:7:18 value=(@drawable/ic_launcher) Suggestion: ad

我一直看到这条信息,不知道如何永远解决它

Error:(43, 9) Attribute application@icon value=(@drawable/new_app_icon) from AndroidManifest.xml:43:9
    is also present at com.github.erizet.signala:signala-longpolling:0.20:7:18 value=(@drawable/ic_launcher)
    Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:40:5 to override
:OpenBook:processDebugManifest FAILED
Error:Execution failed for task ':OpenBook:processDebugManifest'.
> Manifest merger failed with multiple errors, see logs
错误:(43,9)属性application@icon值=(@drawable/new_app_icon)来自AndroidManifest.xml:43:9
也出现在com.github.erizet.signala:signalalongpolling:0.20:7:18 value=(@drawable/ic_launcher)
建议:在AndroidManifest.xml:40:5处的元素中添加“tools:replace=“android:icon””以覆盖
:OpenBook:processDebugManifest失败
错误:任务“:OpenBook:processDebugManifest”的执行失败。
>清单合并失败,出现多个错误,请参阅日志
尝试将
android:replace=“android:icon”
添加到我的清单中,即使是使用我的图标

我试图从库中删除
android:icon=“@drawable/ic_launcher
,但在我构建时,它会不断返回,因为它是从maven导入的


有什么想法吗?

这似乎是gradle的主要合并工具的错误

通过添加到我的清单标签
xmlns:tools=”解决了这个问题http://schemas.android.com/tools“

然后将
tools:replace=“android:icon,android:theme”
添加到应用程序标记中

tools:replace="android:icon"
这告诉合并使用我的清单图标和主题,而不是其他库


希望对您有所帮助,谢谢

Shimi_tap的回答是解决问题的正确方法。如果您想使用旧的合并工具,可以将其添加到build.gradle文件中

安卓{ UseOldManifestment合并为true
}shimi_tap的回答就足够了。 要记住的是,只选择你需要的。从{图标、名称、主题、标签}中选择。
我添加了
tools:replace=“安卓:图标,安卓:主题”
,它不起作用。我添加了
tools:replace=“安卓:图标,安卓:主题,安卓:标签,安卓:名称”
,它不起作用。当我添加
tools:replace=“安卓:图标,安卓:主题,安卓:标签时,它起作用“
。因此,找出清单文件中的冲突到底是什么。

我也有同样的问题,我通过添加
xmlns:tools=”来解决它http://schemas.android.com/tools“
到mainfest文件的顶部,并添加
tools:replace=“android:icon”
使其看起来像

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"  // add tools line here 
    package="yourpackage">


    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        tools:replace="android:icon"> ///add this line 

.....

</application>

</manifest>

///添加这一行
.....

由于某些原因,android studio不喜欢从drawable文件夹中调用应用程序图标。所以在这种情况下,我在res文件夹下创建了mipmap资源目录

右键单击res folder>new>android资源目录>资源类型:mipmap然后将任何图标放到其中,然后将其引用到清单文件中。分享这个,因为这个方法对我有效

android:icon:@drawable/ic_launcher“


android:icon=“@mipmap/ic_launcher”经过长时间的谷歌搜索后获得了解决方案

只需将您的ic_启动器粘贴到您的drawables文件夹中

转到您的清单并更改android:icon=“@drawable/ic\u launcher”

清理项目并重建


希望它能帮助您如果没有任何效果,请关闭Android Studio。继续app/src/main,在文本编辑器中打开文件AndroidManifest.xml(如submite),删除/替换错误行,保存并重新打开Android Studio。

当您的应用程序的minSdk高于任何库的minSdk时,也会发生此错误

app's minSdk >= libraries minSdk

我在将图标从drawable更改为mipmap时遇到问题

我只是没赶上

tools:replace=“安卓:图标”


在清单中。

我也有同样的错误,只是这段代码解决了我的问题,我想与您分享:

Manifest.xml
中:

  • 将此代码添加到xml文件顶部:

    xmlns:tools=”http://schemas.android.com/tools“

  • 然后添加:

    tools:replace=“android:icon,android:theme,android:label,android:name”
    到应用程序标签

    tools:replace="android:icon"
    
当属性值包含占位符(请参见下面的格式)时 清单合并将使用插入的 注入的值在build.gradle中指定 for占位符值为${name},因为@是为链接保留的。之后 上次文件合并发生在结果合并之前 android清单文件被写入,所有值都带有一个占位符 将与注入值交换。生成中断将 如果变量名未知,则生成


对我来说,这个问题发生在更新Google Play服务之后。我正在使用的一个库在其Grade参考中使用“+”合并了这个库,如

compile'com.google.android.gms:play services:+'


这产生了一个问题,因为该库所针对的min版本低于当前版本的Google Play Services所针对的版本。我只是通过查看日志发现了这一点。

在您的
中。gradle
更改MinSDK,例如:

  • build.gradle
    (模块:应用程序)
    • 之前:
      minSdkVersion 9
    • 之后:
      minSdkVersion 14

等等。

只需添加
xmlns:tools=”http://schemas.android.com/tools“
到你的清单标签,然后你需要在前面添加
工具:replace=“android:icon”
安卓:icon=“@mipmap/ic\u launcher”
,我尝试了上面提到的所有解决方案

Manifest.xml
中:

  • 在清单标记中的xml文件顶部添加此代码:

    xmlns:tools=”http://schemas.android.com/tools“

  • 然后添加:

    tools:replace=“android:icon,android:theme,android:label,android:name”
    到应用程序标签

    tools:replace="android:icon"
    
我需要删除一个位于中的xml文件

mipmap-anydpi-v26