41

I'm trying to "make project" with Android Studio, and I'm getting this error:

Execution failed for task ':myApp:processGoogleDebugManifest'.

Could not get unknown property 'manifestOutputDirectory' for task ':myApp:processGoogleDebugManifest' of type com.android.build.gradle.tasks.ProcessMultiApkApplicationManifest.

Any help please?

EDIT: This error occurred after I updated to gradle v6.5 and plugin v4.1.0. If I revert to gradle v6.1.1 and plugin v4.0.0 the error disappears.

glinda93
  • 7,659
  • 5
  • 40
  • 78
Sergio Viudes
  • 2,714
  • 5
  • 26
  • 44

5 Answers5

80

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.

See Latest Huawei's AG Connect plugin here: https://developer.huawei.com/latest/plugin/agconnect ...Just scroll, you'll find it there haha!

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.

PhillipJacobs
  • 2,337
  • 1
  • 16
  • 32
row
  • 816
  • 5
  • 3
12

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

mehrdad seyrafi
  • 3,084
  • 2
  • 19
  • 16
4

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)
        }
    }
}  
Mathieu de Brito
  • 2,536
  • 2
  • 26
  • 30
4

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.

glinda93
  • 7,659
  • 5
  • 40
  • 78
  • this helped me figure out why I couldn't get bugsnag working on the latest version of React Native 64.2. thx! – Dres Jun 23 '21 at 14:17
0
android.applicationVariants.all {
    outputs.all {
        processManifestProvider.configure {
            val multiApkManifestOutputDirectory = (this as ProcessMultiApkApplicationManifest)
                .multiApkManifestOutputDirectory // 
            doLast {
                multiApkManifestOutputDirectory.get()
                    .asFile
                    .walkTopDown()
                    .forEach { 
                        
                    }
            }
        }
    }
}
TonnyL
  • 1,226
  • 1
  • 12
  • 17