无法获取未知属性'manifestFile'

时间:2017-11-24 08:31:13

标签: android

Android Studio gradle版本中的

distributionUrl=https\://services.gradle.org/distributions-snapshots/gradle-4.5-20171123235935+0000-all.zip

classpath 'com.android.tools.build:gradle:3.1.0-alpha04'

收到此错误

Error:Could not get unknown property 'manifestFile' for task ':backend:generateDebugRFile' of type com.android.build.gradle.internal.res.GenerateLibraryRFileTask.

尝试更改gradle,Studio版本等不会影响

2 个答案:

答案 0 :(得分:2)

首先,关于使用预发布(alpha)软件的常规警告适用:如果您因任何特殊原因不需要使用alpha,请考虑使用稳定版本。现在这意味着

有了这个......可能是3.1.0-alpha04插件删除了对manifestFile的支持,而你正在使用的其他插件仍然依赖于此。毕竟,工具团队did remove在3.0中具有类似名称的manifestOutputFile

我尝试使用

构建项目
  • Gradle dist 4.4-rc-3
  • Android Gradle插件3.1.0-alpha04
  • Fabric Gradle插件1.25.0

应用了Fabric插件并收到了一条与您发布的内容非常相似的错误消息:

Caused by: groovy.lang.MissingPropertyException: Could not get unknown property 'manifestFile' for task ':libs:generateProdDebugRFile' of type com.android.build.gradle.internal.res.GenerateLibraryRFileTask.
    at org.gradle.internal.metaobject.AbstractDynamicObject.getMissingProperty(AbstractDynamicObject.java:83)
    at org.gradle.internal.metaobject.AbstractDynamicObject.getProperty(AbstractDynamicObject.java:61)
    at com.android.build.gradle.internal.res.GenerateLibraryRFileTask_Decorated.getProperty(Unknown Source)
    at com.crashlytics.tools.gradle.CrashlyticsPlugin.addPluginTasks(CrashlyticsPlugin.groovy:239)
    at com.crashlytics.tools.gradle.CrashlyticsPlugin.this$2$addPluginTasks(CrashlyticsPlugin.groovy)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at com.crashlytics.tools.gradle.CrashlyticsPlugin$_addPluginTasksToLibraryVariantsIn_closure4.doCall(CrashlyticsPlugin.groovy:122)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:71)
    at org.gradle.util.ConfigureUtil.configureTarget(ConfigureUtil.java:160)
    at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:106)
    at org.gradle.util.ConfigureUtil$1.execute(ConfigureUtil.java:123)
    at org.gradle.internal.ImmutableActionSet$SingletonSet.execute(ImmutableActionSet.java:155)
    at org.gradle.internal.MutableActionSet.execute(MutableActionSet.java:35)
    at org.gradle.api.internal.DefaultDomainObjectCollection.doAdd(DefaultDomainObjectCollection.java:204)
    at org.gradle.api.internal.DefaultDomainObjectCollection.add(DefaultDomainObjectCollection.java:198)
    at com.android.build.gradle.LibraryExtension.addVariant(LibraryExtension.java:90)
    at com.android.build.gradle.FeatureExtension.addVariant(FeatureExtension.java:108)
    at com.android.build.gradle.internal.ApiObjectFactory.create(ApiObjectFactory.java:132)
    at com.android.build.gradle.BasePlugin.lambda$createAndroidTasks$6(BasePlugin.java:709)
    at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:81)
    at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.java:695)
    at com.android.build.gradle.BasePlugin.lambda$null$4(BasePlugin.java:613)
    at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:81)
    at com.android.build.gradle.BasePlugin.lambda$createTasks$5(BasePlugin.java:609)
    at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:91)
    at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:80)
    at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:42)
    at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:230)
    at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:149)
    at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
    at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:324)
    at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:234)
    at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:140)
    at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:37)
    at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
    at com.sun.proxy.$Proxy26.afterEvaluate(Unknown Source)
    at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:76)
    ... 81 more

答案 1 :(得分:0)

与Crashlytics集成有类似的问题,发现我需要添加

crashlytics { instantAppSupport true }

即使我没有使用Instant Apps,也需要这样做。

this answer in SO

找到