错误:清单任务不再支持manifestOutputFile属性,请改为使用manifestOutputDirectory. (Android Studio 3.0) [英] Error:Manifest Tasks does not support the manifestOutputFile property any more, please use the manifestOutputDirectory instead. (Android Studio 3.0)

查看:751
本文介绍了错误:清单任务不再支持manifestOutputFile属性,请改为使用manifestOutputDirectory. (Android Studio 3.0)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近迁移到Android Studio 3.0时出现错误消息.

I get below error when I had migrated to Android Studio 3.0 recently.

错误:清单任务不再支持manifestOutputFile属性,请改用manifest清单输出目录.

我尝试按照以下步骤操作: https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html ,但仍然出现相同的错误.

I tried following the steps in: https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html but still get the same error.

我的build.gradle如下:

My build.gradle is as follows:

buildscript {
    repositories {
        jcenter()
        mavenCentral()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
    }
}
allprojects {
    repositories {
        jcenter()
        mavenCentral()
        google()
        maven { url 'https://maven.google.com' }
    }
}

模块的build.gradle如下:

Module's build.gradle is as follows:

    apply plugin: 'com.android.application'

    android {
        compileSdkVersion 25
        buildToolsVersion '25.0.3'

        defaultConfig {
            applicationId "com.example.rakesh"

            minSdkVersion 15
            targetSdkVersion 25
            multiDexEnabled true
        }

        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            }
        }

        dataBinding {
            enabled true
        }

    }


    buildscript {

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

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

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
}

推荐答案

确保已在根gradle.build中添加了新的存储库:

Make sure you added the new repo in root gradle.build:

repositories {
    maven {
        url 'https://maven.google.com'
    }
}

您还可以使用较新的Gradle包装器:

You may also use with newer Gradle wrapper:

repositories {
        maven {
            google()
        }
    }

如果您在回购中使用了数据绑定,请确保已添加:

If you have used data binding in repo, then make sure you have added:

android {
    ....
    dataBinding {
        enabled = true
    }
}

这是最好的方法.

在您的root级别gradle.build中使用

In your root level gradle.build use below

buildscript {
    repositories {
        mavenCentral()
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenCentral()
        jcenter()
        google()
    }
}

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

,然后在您的gradle-wrapper.properties文件中,更改包装器版本,如下所示

and in your gradle-wrapper.properties file change the wrapper version as below

distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-all.zip

还要在您的应用程序级别build.gradle中确保使用的是26个版本,如下所示:

Also in your app level build.gradle make sure you are using 26 version as below:

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId "com.xxxx"
        minSdkVersion 16
        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'
        }
    }
}

这篇关于错误:清单任务不再支持manifestOutputFile属性,请改为使用manifestOutputDirectory. (Android Studio 3.0)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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