Crashlytics could not find the manifest

2019-03-18 14:55发布

问题:

The Fabric SDK (for Android) intermittently fails builds with the following error:

ERROR - Crashlytics Developer Tools error.
com.crashlytics.tools.android.project.ManifestData$ManifestIOException: Crashlytics could not find the manifest. Not found at /Users/Shared/Jenkins/Home/workspace/my_project@2/true
    at com.crashlytics.tools.android.project.ManifestFileProvider.getManifestStream(ManifestFileProvider.java:32)
    at com.crashlytics.tools.android.project.DefaultManifestData.createManifest(DefaultManifestData.java:124)
...

There is no apparent pattern for when it will or will not fail the build, so any clues to debug this really irritating problem would be appreciated.

/Users/Shared/Jenkins/Home/workspace/my_project@2/true

... doesn't look like the path to any manifest, imo, but I've no idea why it would look there.

Edit to add: here's a more complete stacktrace for another build. pull_request_build is the name of the Jenkins job; it's legitimately the root directory of the project.

15:41:46 ERROR - Crashlytics Developer Tools error.
15:41:46 com.crashlytics.tools.android.project.ManifestData$ManifestIOException: Crashlytics could not find the manifest. Not found at /Users/Shared/Jenkins/Home/workspace/pull_request_build@2/true
15:41:46    at com.crashlytics.tools.android.project.ManifestFileProvider.getManifestStream(ManifestFileProvider.java:32)
15:41:46    at com.crashlytics.tools.android.project.DefaultManifestData.createManifest(DefaultManifestData.java:124)
15:41:46    at com.crashlytics.tools.android.project.StandardAndroidProjectFactory.createTypedProject(StandardAndroidProjectFactory.java:176)
15:41:46    at com.crashlytics.tools.android.project.StandardAndroidProjectFactory.create(StandardAndroidProjectFactory.java:118)
15:41:46    at com.crashlytics.tools.android.project.StandardAndroidProjectFactory.create(StandardAndroidProjectFactory.java:93)
15:41:46    at com.crashlytics.tools.android.DeveloperTools.processProperties(DeveloperTools.java:483)
15:41:46    at com.crashlytics.tools.android.DeveloperTools.processArgsInternal(DeveloperTools.java:348)
15:41:46    at com.crashlytics.tools.android.DeveloperTools.gradleMain(DeveloperTools.java:292)
15:41:46    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
15:41:46    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
15:41:46    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
15:41:46    at java.lang.reflect.Method.invoke(Method.java:498)
15:41:46    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
15:41:46    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
15:41:46    at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.invoke(StaticMetaMethodSite.java:46)
15:41:46    at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.call(StaticMetaMethodSite.java:91)
15:41:46    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
15:41:46    at com.crashlytics.tools.gradle.tasks.FabricTaskBuilder.callDevtoolsWrappingRuntimeExceptions(FabricTaskBuilder.groovy:330)
15:41:46    at com.crashlytics.tools.gradle.tasks.FabricTaskBuilder.this$2$callDevtoolsWrappingRuntimeExceptions(FabricTaskBuilder.groovy)
15:41:46    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
15:41:46    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
15:41:46    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
15:41:46    at java.lang.reflect.Method.invoke(Method.java:498)
15:41:46    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
15:41:46    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
15:41:46    at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:384)
15:41:46    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
15:41:46    at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69)
15:41:46    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
15:41:46    at com.crashlytics.tools.gradle.tasks.FabricTaskBuilder$_pluginGenerateResources_closure4.doCall(FabricTaskBuilder.groovy:129)
15:41:46    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
15:41:46    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
15:41:46    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
15:41:46    at java.lang.reflect.Method.invoke(Method.java:498)
15:41:46    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
15:41:46    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
15:41:46    at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
15:41:46    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
15:41:46    at groovy.lang.Closure.call(Closure.java:414)
15:41:46    at groovy.lang.Closure.call(Closure.java:430)
15:41:46    at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:681)
15:41:46    at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:656)
15:41:46    at org.gradle.api.internal.tasks.TaskMutator$LeftShiftTaskAction.execute(TaskMutator.java:107)
15:41:46    at org.gradle.api.internal.tasks.TaskMutator$LeftShiftTaskAction.execute(TaskMutator.java:96)
15:41:46    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
15:41:46    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
15:41:46    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
15:41:46    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
15:41:46    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
15:41:46    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)
15:41:46    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
15:41:46    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
15:41:46    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
15:41:46    at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
15:41:46    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
15:41:46    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
15:41:46    at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
15:41:46    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
15:41:46    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
15:41:46    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
15:41:46    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
15:41:46    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
15:41:46    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
15:41:46    at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
15:41:46    at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
15:41:46    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
15:41:46    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
15:41:46    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
15:41:46    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
15:41:46    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
15:41:46    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
15:41:46    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
15:41:46    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
15:41:46    at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
15:41:46    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
15:41:46    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
15:41:46    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
15:41:46    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
15:41:46    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
15:41:46    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
15:41:46    at java.lang.Thread.run(Thread.java:748)

回答1:

We were also seeing similar build errors in a couple of modules in our multi module project. Sometimes it manifested as ManifestIOException: Crashlytics could not find the manifest, other times as a usage statement followed by NullPointerException in com.crashlytics.tools.utils.PropertiesUtils.getProperties().

Both of the affected modules were library modules where both the application and its library module were using Crashlytics. We fixed the error as follows:

  1. Move the following line from library build.gradle to application build.gradle:

    apply plugin: 'io.fabric'

  2. Move any crashlytics blocks from library build.gradle to application build.gradle:

    crashlytics { enableNdk true }

We left the Crashlytics dependencies intact in both the application and library module, only the plugin was relocated. It seems like Crashlytics does not like to be integrated in library modules for some reason and will complain about it at compile time, so it's better to integrate Crashlytics in your app module and just add the dependencies to the library if your library needs to do anything with Crashlytics.