Could not get unknown property 'manifestOutputDirectory'

If you're using bugsnag, replace the following line

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


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



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

with this:

classpath 'com.huawei.agconnect:agcp:'


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:, but when I updated it to com.huawei.agconnect:agcp: 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.