无法获得未知 属性 'manifestOutputDirectory'
Could not get unknown property 'manifestOutputDirectory'
我正在尝试使用 Android Studio“制作项目”,但出现此错误:
任务“:myApp:processGoogleDebugManifest”执行失败。
Could not get unknown property 'manifestOutputDirectory' for task ':myApp:processGoogleDebugManifest' of type com.android.build.gradle.tasks.ProcessMultiApkApplicationManifest.
有什么帮助吗?
编辑:这个错误发生在我更新到 gradle v6.5 和插件 v4.1.0 之后。如果我恢复到 gradle v6.1.1 和插件 v4.0.0,错误就会消失。
我今天遇到了同样的问题,在我的情况下,这是由华为的 AG Connect 插件版本过时引起的。我正在使用 com.huawei.agconnect:agcp:1.2.1.301
,但当我将其更新为 com.huawei.agconnect:agcp:1.4.1.300
时,问题已解决。
但如果不是华为的插件问题,您可以通过运行 gradle
和 --stacktrace
选项调试问题,看看问题出在哪里。在 Android Studio 中,您可以在 Settings
/Build, Execution, Deployment
/Compiler
/Command-line options
.
中为 gradle
添加命令行选项
这解决了我同样的问题:
在项目级别 build.gradle 中,替换为:
classpath 'com.huawei.agconnect:agcp:1.3.1.300'
有了这个:
classpath 'com.huawei.agconnect:agcp:1.4.1.300'
参考:https://github.com/Tencent/tinker/issues/1471#issuecomment-710777366
我把它写在这里是因为这个解决方案节省了我的时间:
我们可以通过简单地替换对
的引用来解决这个问题
manifestOutputDirectory
来自
multiApkManifestOutputDirectory
enter code here
在你的 gradle 任务中
例如:
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)
}
}
}
如果您使用的是 bugsnag,请替换以下行
classpath 'com.bugsnag:bugsnag-android-gradle-plugin:4.+'
与:
classpath 'com.bugsnag:bugsnag-android-gradle-plugin:5.+'
更多详情,请参阅本期:Fails with AGP 4.1.0-alpha04 and this comment。
我正在尝试使用 Android Studio“制作项目”,但出现此错误:
任务“:myApp:processGoogleDebugManifest”执行失败。
Could not get unknown property 'manifestOutputDirectory' for task ':myApp:processGoogleDebugManifest' of type com.android.build.gradle.tasks.ProcessMultiApkApplicationManifest.
有什么帮助吗?
编辑:这个错误发生在我更新到 gradle v6.5 和插件 v4.1.0 之后。如果我恢复到 gradle v6.1.1 和插件 v4.0.0,错误就会消失。
我今天遇到了同样的问题,在我的情况下,这是由华为的 AG Connect 插件版本过时引起的。我正在使用 com.huawei.agconnect:agcp:1.2.1.301
,但当我将其更新为 com.huawei.agconnect:agcp:1.4.1.300
时,问题已解决。
但如果不是华为的插件问题,您可以通过运行 gradle
和 --stacktrace
选项调试问题,看看问题出在哪里。在 Android Studio 中,您可以在 Settings
/Build, Execution, Deployment
/Compiler
/Command-line options
.
gradle
添加命令行选项
这解决了我同样的问题:
在项目级别 build.gradle 中,替换为:
classpath 'com.huawei.agconnect:agcp:1.3.1.300'
有了这个:
classpath 'com.huawei.agconnect:agcp:1.4.1.300'
参考:https://github.com/Tencent/tinker/issues/1471#issuecomment-710777366
我把它写在这里是因为这个解决方案节省了我的时间:
我们可以通过简单地替换对
的引用来解决这个问题manifestOutputDirectory
来自
multiApkManifestOutputDirectory
enter code here
在你的 gradle 任务中
例如:
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) } } }
如果您使用的是 bugsnag,请替换以下行
classpath 'com.bugsnag:bugsnag-android-gradle-plugin:4.+'
与:
classpath 'com.bugsnag:bugsnag-android-gradle-plugin:5.+'
更多详情,请参阅本期:Fails with AGP 4.1.0-alpha04 and this comment。