所以,我是Android和Java的初学者.我刚开始学习.我今天在试用Intent时遇到了错误.
Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed with multiple errors, see logs
Run Code Online (Sandbox Code Playgroud)
我在这里找到了一些解决方案并试图实现它们,但它没有用.
这是我的build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.example.rohan.petadoptionthing"
minSdkVersion 10
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.0'
}
Run Code Online (Sandbox Code Playgroud)
这是我的AndroidManifest:
<?xml version="1.0" encoding="utf-8"?>
Run Code Online (Sandbox Code Playgroud)
package="com.example.rohan.petadoptionthing" >
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Second"
/>
<activity android:name=".third"/>
<activity android:name=".MainActivity"/>
</application>
Run Code Online (Sandbox Code Playgroud)
这是我编码的第一周,如果这是一件非常愚蠢的话,我很抱歉.我真的很陌生,没有找到任何其他地方要问.对不起,如果我违反任何规则
And*_*eek 117
<activity android:name=".MainActivity"/>
从您的mainfest文件中删除 .正如您已将其定义为:
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
所以,Manifest文件显示模棱两可.
Kim*_*gra 59
我也遇到了同样的问题,经过大量研究后发现了解决方案:
- 你的min sdk版本应该与你正在使用的模块相同,例如:你的模块min sdk版本是14,你的app min sdk版本是9它应该是相同的.
- 如果你的应用程序和模块的构建版本不一样.同样它应该相同**简而言之,您的应用程序
build.gradle
文件和清单应该具有相同的配置**- 清单文件中两次添加相同权限没有重复,相同的活动提到两次.
- 如果您从项目中删除了任何活动,也可以从清单文件中删除它.
- 有时它是因为清单文件的标签,图标等标签:
a)
xmlns:tools
在清单标记中添加该行.b)添加
tools:replace=
或tools:ignore=
在应用程序标签中.
例:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.slinfy.ikharelimiteduk"
xmlns:tools="http://schemas.android.com/tools"
android:versionCode="1"
android:versionName="1.0" >
<application
tools:replace="icon, label"
android:label="myApp"
android:name="com.example.MyApplication"
android:allowBackup="true"
android:hardwareAccelerated="false"
android:icon="@drawable/ic_launcher"
android:theme="@style/Theme.AppCompat" >
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
- 如果两个依赖不相同的版本例如:您正在使用程序兼容性V7依赖:26.0.0和Facebook的com.facebook.android:facebook-android-sdk:[4,5)Facebook的使用版本com.android的cardview.支持:cardview-v7:25.3.1和appcompat v7:26.0.0使用版本v7:26.0.0的cardview,因此两个库中存在distrpancy因此给出错误
错误:任务':app:processDebugManifest'的执行失败.
清单合并失败:27:9从[com.android.support:appcompat-v7:26.0.0-alpha1]的AndroidManifest.xml属性meta-data#android.support.VERSION@value值=(26.0.0-ALPHA1) -38也存在于[com.android.support:cardview-v7:25.3.1] AndroidManifest.xml:24:9-31 value =(25.3.1).建议:在AndroidManifest.xml:25:5-27:41中添加'tools:replace ="android:value"'来覆盖.
因此,通过使用版本25.3.1的appcompat,我们可以避免此错误
通过考虑以上几点,你将摆脱这个恼人的问题.您也可以查看我的博客 https://wordpress.com/post/dhingrakimmi.wordpress.com/23
Ani*_*ban 56
对我来说这是有效的 -
寻找合并错误 AndroidManifest.xml
点击Merged Manifest in AndroidManifest.xml
您可以在右列中查看清单合并错误.它可能有助于解决这个问题.
小智 18
如果您的项目针对 Android 12,则将其添加到所有<activity>
标签中<intent-filter>
android:exported="true/false"
Run Code Online (Sandbox Code Playgroud)
Pre*_*ker 12
我遇到了同样的问题,我刚刚在manifest.xml中添加了一行,它对我有用.
tools:replace="android:allowBackup,icon,theme,label,name">
Run Code Online (Sandbox Code Playgroud)
在此下添加此行
<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="@drawable/launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:screenOrientation="portrait"
android:supportsRtl="true"
android:theme="@style/AppThemecustom"
tools:replace="android:allowBackup,icon,theme,label">
Run Code Online (Sandbox Code Playgroud)
希望它会有所帮助.
Chi*_*hah 10
除了可用的解决方案,请同时检查.
如果您已经设置了android:allowBackup="false"
,AndroidManifest.xml
则android:allowBackup="true"
其他依赖项可能存在冲突.
解决方案
正如@CLIFFORD PY所建议的那样,切换到Merged Manifest
你的AndroidManifest.xml
.Android的工作室会建议添加tools:replace="android:allowBackup"
在<application />
你的AndroidManifest.xml
.
我也面临这个错误。在构建日志中,最后一行是“无法编译值文件”。
因此,如果您遇到同样的问题,那么只需在 gradle.properties 文件中添加以下行很可能会解决该问题。
android.enableJetifier=true
Run Code Online (Sandbox Code Playgroud)
我的意思是它Manifest Merger failed with multiple errors in Android Studio
为我修复了错误。
在我的情况下,它显示错误,因为<uses-permission>
元素中存在冗余.因此,请检查您的AndroidManifest.xml
文件是否相同.
Android Studio版本是3.0.1
操作系统是Windows 7
这是截图供参考.
只需在您的项目清单应用程序标记中添加以下代码即可...
<application
tools:node="replace">
Run Code Online (Sandbox Code Playgroud)
小智 6
通常在清单中出现错误时发生.打开AndroidManifest.xml.单击合并的清单选项卡.可以在那里看到错误.还包括那里提到的建议.当我在导入com.google.android.gms时出现类似问题时.maps.model.LatLng,它建议我在应用程序标记中包含工具:overrideLibrary ="com.google.android.gms.maps",并且构建成功.
归档时间: |
|
查看次数: |
254990 次 |
最近记录: |