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

时间:2017-06-16 07:50:33

标签: android android-studio android-manifest

我对Android Studio来说是全新的,所以对于有经验的人来说这听起来可能是个愚蠢的事情。

我在Android Studio中收到错误消息:

=8*4

我用谷歌搜索了这个并尝试用它自己解决它,然而,我发现的类似问题并非完全相同的错误。

虽然我了解其中的一部分,但我没有足够的经验来理解和生成修复程序。

我可能需要提供更多相关信息,如果有,请告诉我。

修改

的AndroidManifest.xml

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION@value 
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.

build.gradle(项目:appname)

<?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
}

第二次编辑:

根据Arefeh的回答和Kunal的评论,我通过将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' } 替换为compile 'com.android.support:design:25.3.1'来更改版本不匹配。

为了实现这一目标,我必须在compile 'com.android.support:design:26.0.0-beta2'内的maven { url "https://maven.google.com" }文件中添加build.gradle (Project: appname)(已在上面进行了更新以说明这一点)。

现在我不断收到allprojects{}的渲染错误。每个活动的类别都不同,这取决于我在活动中使用的内容,例如

failed to instantiate one or more classes

2 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:0)

在这个例子中似乎有效的是File > Project Structure然后在app > PropertiesCompile Sdk VersionBuild Tools Version,我将它们更改为API 25: Android 7.1.1 (Nougat)分别和25.0.3。之后我同步了项目并重新进行了重建。 然后我重复了这个过程,然后再次改回API 26: Android 8.0 (O)26.0.0。到目前为止它仍然有效,但如果这种情况发生变化我会更新。

相关问题