Error:Manifest Tasks does not support the manifestOutputFile property any more, please use the manifestOutputDirectory instead. (Android Studio 3.0)

安稳与你 提交于 2019-12-24 00:21:37

问题


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

Error:Manifest Tasks does not support the manifestOutputFile property any more, please use the manifestOutputDirectory instead.

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.

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

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')
}

回答1:


once having seen the actual build.gradle ...

you need to build with buildToolsVersion '26.0.2' (or later), which is the least required version - while there are no instructions, which would be directly related to the given error message. it's a little strange, that it does not complain about the buildToolsVersion mismatch, in the first place.

the buildscript part does not belong into there (removing that from the module's build.gradle might already be the remedy). also, delete the .gradle and all the build directories, before trying to build.




回答2:


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

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

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

This is the best way to do it.

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
}

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

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


来源:https://stackoverflow.com/questions/47089953/errormanifest-tasks-does-not-support-the-manifestoutputfile-property-any-more

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!