Android Studio错误:任务':app:processDebugManifest'的执行失败'

问题描述:

我对Android Studio完全陌生,因此对于有经验的人来说听起来可能很愚蠢。Android Studio错误:任务':app:processDebugManifest'的执行失败'

我越来越Android Studio中的错误,指出:

Error:Execution failed for task ':app:processDebugManifest'. 
> Manifest merger failed : Attribute meta-data#[email protected] 
value=(25.3.1) from [com.android.support:design:25.3.1] 
AndroidManifest.xml:27:9-31 
is also present at [com.android.support:appcompat-v7:26.0.0-alpha1] 
AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1). 
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at 
AndroidManifest.xml:25:5-27:34 to override. 

我用Google搜索这一点,并试图寻找到它,解决它在我自己的,但是,我也发现了类似的问题也不尽相同的错误。

我没有足够的经验来理解和生成一个修复程序,虽然我理解它的一些。

可能是这种情况,我需要提供更多的信息,所以请让我知道如果是这样。

EDIT

的AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.g732d.appname" 
    > 

    <application 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="@string/app_name" 
     android:roundIcon="@mipmap/ic_launcher_round" 
     android:supportsRtl="true" 
     android:theme="@style/AppTheme"> 

     <activity 
      android:name=".HomeActivity" 
      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=".Patients" /> 

     <activity android:name=".NewPatient" /> 

     <activity android:name=".StartActivity"></activity> 

    </application> 

</manifest> 

的build.gradle(项目:应用程序名称)

// Top-level build file where you can add configuration options common to 
all sub-projects/modules. 

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.3.3' 

     // NOTE: Do not place your application dependencies here; they 
belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
     maven { 
      url "https://maven.google.com" 
     } 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

的build.gradle(模块: App)

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 26 
    buildToolsVersion "26.0.0" 
    defaultConfig { 
     applicationId "com.g732d.appname" 
     minSdkVersion 19 
     targetSdkVersion 26 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    compile 'com.android.support:appcompat-v7:26.+' 
    compile 'com.android.support.constraint:constraint-layout:1.0.2' 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:design:25.3.1' 
    compile 'com.google.android.gms:play-services-ads:11.0.1' 
    compile 'com.google.android.gms:play-services-maps:11.0.1' 
} 

第二个编辑:

继Arefeh答案,并通过注:Kunal的评论,我用compile 'com.android.support:design:26.0.0-beta2'更换compile 'com.android.support:design:25.3.1'改变的版本不匹配。

为了达到这个目的,我必须在build.gradle (Project: appname)文件allprojects{}(上面已更新以说明这一点)中添加maven { url "https://maven.google.com" }

现在我不断收到一个渲染错误,说failed to instantiate one or more classes。根据我在活动中使用的内容,每个活动的类别不同,例如

The following classes could not be instantiated: 
    - android.support.v7.widget.AppCompatImageView 
    ... 
    ... 
+0

发布您的'清单'和'build.gradle' – dustblue

+0

感谢dustblue,我刚刚通过编辑的方式添加它们。 – Gazza732

+0

请添加另一个gradle文件。 'build.gradle(Module:app)' –

我想问题是支持库版本之间的差异。将您的设计库版本更改为26或更高版本。 编译“com.android.support:design:26.+”

+0

感谢您的回答。我该如何改变这种遗憾?它说在我附加的代码中的26,所以我假设它是一个设置,虽然我可能是错的? – Gazza732

+0

在您的build.gradle文件的依赖关系部分,将compile'c​​om.android.support:design:26.+'替换为compile'c​​om.android.support:design:25.3.1'。 你应该在你所有的依赖和版本中使用相同版本的支持库:) –

什么,似乎在这种情况下发挥了作用,是要File > Project Structure然后在app > Properties在那里说Compile Sdk VersionBuild Tools Version,我将它们分别改为API 25: Android 7.1.1 (Nougat)25.0.3 。之后,我同步了项目和gradle,然后重建。 然后我重复了这个过程并再次改回API 26: Android 8.0 (O)26.0.0。到目前为止,它仍在工作,尽管如果这种变化我会更新。