Could not get unknown property 'manifestOutputDirectory'

If you're using bugsnag, replace the following line

classpath 'com.bugsnag:bugsnag-android-gradle-plugin:4.+'

with:

classpath 'com.bugsnag:bugsnag-android-gradle-plugin:5.+'

For further detail, see this issue: Fails with AGP 4.1.0-alpha04 and this comment.


I write it here because this solution saved my day :

We can fix this by simply replacing references to

manifestOutputDirectory

by

multiApkManifestOutputDirectory
enter code here

in your gradle tasks

For example :

android.applicationVariants.all { variant ->
    variant.outputs.all { output ->
        output.processManifest.doLast { task ->
            def outputDir = multiApkManifestOutputDirectory.asFile.get()
            String manifestMergerpath = "$outputDir/AndroidManifest.xml"
            writeManifest(manifestMergerpath, placeholders)
        }
    }
}  

This solved my same problem:

In the project level build.gradle, replace this:

classpath 'com.huawei.agconnect:agcp:1.3.1.300'

with this:

classpath 'com.huawei.agconnect:agcp:1.4.1.300'

Reference: https://github.com/Tencent/tinker/issues/1471#issuecomment-710777366


I encountered this same issue today, in my case it was caused by an outdated version of Huawei's AG Connect plugin. I was using com.huawei.agconnect:agcp:1.2.1.301, but when I updated it to com.huawei.agconnect:agcp:1.4.1.300 the issue was fixed.

But if Huawei's plugin is not the problem you are having, you can debug the issue by running gradle with --stacktrace option to see where the issue originates from. In Android Studio you can add command line options for gradle in Settings/Build, Execution, Deployment/Compiler/Command-line options.