Firebase Performance Monitoring库与以签名的jar分发的库不兼容

时间:2018-10-12 10:26:02

标签: android firebase gradle androidx firebase-performance

将我的项目从27更新到AndroidX和targetSdkVersion到28后,尝试构建时出现以下gradle错误:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformClassesWithFirebasePerformancePluginFor[Flavour]'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:110)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77)
    at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
    at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
    at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
    at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
    at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:51)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)
    at org.gradle.execution.taskgraph.LocalTaskInfoExecutor.execute(LocalTaskInfoExecutor.java:42)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:277)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:262)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:135)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:130)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.execute(DefaultTaskPlanExecutor.java:200)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.executeWithWork(DefaultTaskPlanExecutor.java:191)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.run(DefaultTaskPlanExecutor.java:130)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.SecurityException: SHA-256 digest error for META-INF/maven/at.favre.lib/bcrypt/pom.xml
    at sun.security.util.ManifestEntryVerifier.verify(ManifestEntryVerifier.java:218)
    at java.util.jar.JarVerifier.processEntry(JarVerifier.java:241)
    at java.util.jar.JarVerifier.update(JarVerifier.java:228)
    at java.util.jar.JarInputStream.read(JarInputStream.java:212)
    at com.google.common.io.ByteStreams.toByteArrayInternal(ByteStreams.java:181)
    at com.google.common.io.ByteStreams.toByteArray(ByteStreams.java:221)
    at com.google.firebase.perf.plugin.instrumentation.Instrument.instrumentClassesInJar(Instrument.java:105)
    at com.google.firebase.perf.plugin.FirebaseTransform.transformJarInputs(FirebaseTransform.java:230)
    at com.google.firebase.perf.plugin.FirebaseTransform.transform(FirebaseTransform.java:192)
    at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:239)
    at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:235)
    at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102)
    at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:230)
    at sun.reflect.GeneratedMethodAccessor899.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
    at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
    at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:131)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:120)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:99)
    ... 34 more

错误指向项目中使用的Bcrypt库。但是我已经用jarsigner验证了jar签名,并且它是有效的。

我正在使用:

  • Android Studio 3.3 Canary 13
  • 4.10.2级
  • 适用于Gradle 3.2.0的Android插件
  • Firebase性能监控Gradle插件1.1.5
  • Firebase性能监控16.1.2

如果我从项目中删除了Firebase Performance Monitoring依赖关系,一切都会很好。

a similar issue posted in SO,但这是jacoco造成的。我根本不使用雅各布。

有什么想法吗?谢谢。


更新12/10/18:

重现此问题的示例应用程序:
https://github.com/davidmigloz/firebase-performance-bug

更新18/10/26:

我已经能够使用Firebase Performance Monitoring库以及任何其他以签名的jar 分发的库来重现该错误。

更新18/10/26:

如果启用“即时运行”,则会出现相同的错误(尽管文件不同),但在“即时运行gradle”任务中:

Execution failed for task ':app:transformClassesWithInstantRunForDebug'.
> com.android.build.api.transform.TransformException: java.lang.SecurityException: java.lang.SecurityException: SHA-256 digest error for at/favre/lib/crypto/bcrypt/BCryptFormatter.class

2 个答案:

答案 0 :(得分:0)

Firebase支持团队已确认我这是他们最后的错误。但是他们提出了这种暂时的解决方法:

  

我们调查了一下,发现了一个错误。但是,能够找出一个   解决此问题的方法:

     

步骤1)在您的gradle-wrapper.properties文件中,更新   distributionUrl:

     

distributionUrl=https://services.gradle.org/distributions/gradle-5.0-all.zip

     

第2步)在顶级build.gradle文件中更新Android   Gradle插件:

     

classpath 'com.android.tools.build:gradle:3.4.0-alpha05'

     

第3步)在您的gradle.properties文件中,添加以下行:

     

# Blacklist libraries from being Jetified
  android.jetifier.blacklist=bcrypt,bytes

     

第4步)清洁构建项目

     

运行./gradlew :app:assembleDebug现在应该可以成功。

     

在我们进行修复时,请使用上述解决方法来获取   您启动并运行。我很抱歉再次在这里等待。

答案 1 :(得分:0)

这似乎已在新的Firebase Gradle插件版本(1.2.0)中修复。 您仍然需要将AS 3.4与3.4 Android Gradle插件一起使用。