Firebase Performance Monitoring, Can't instrument...IllegalArgumentException
Asked Answered
O

1

6

I'm using implementation 'com.google.firebase:firebase-perf:19.0.5'

I applied the plugin: apply plugin: 'com.google.firebase.firebase-perf'

and in my project level gradle: classpath 'com.google.firebase:perf-plugin:1.3.1'

I'm running into a few issues. 1) during my build, I see a lot of Can't instrument exceptions like this:

Can't instrument: kotlin/reflect/jvm/internal/impl/load/java/lazy/descriptors/LazyJavaClassMemberScope$nestedClasses$1$enumMemberNames$1.class
java.lang.IllegalArgumentException
        at org.objectweb.asm.ClassVisitor.<init>(ClassVisitor.java:79)
        at com.google.firebase.perf.plugin.instrumentation.InstrumentationVisitor.<init>(InstrumentationVisitor.java:55)
        at com.google.firebase.perf.plugin.instrumentation.Instrument.instrument(Instrument.java:170)
        at com.google.firebase.perf.plugin.instrumentation.Instrument.instrumentClassesInJar(Instrument.java:117)
        at com.google.firebase.perf.plugin.FirebasePerfTransform.performTransformationFor(FirebasePerfTransform.java:563)
        at com.google.firebase.perf.plugin.FirebasePerfTransform.transformJarInputs(FirebasePerfTransform.java:445)
        at com.google.firebase.perf.plugin.FirebasePerfTransform.transform(FirebasePerfTransform.java:416)
        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.GeneratedMethodAccessor190.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103)
        at

2) I only see logging TraceMetric and no NetworkRequestMetric. the API calls are using Retrofit2, which uses OkHttp3

Ordination answered 4/3, 2020 at 21:11 Comment(1)
If the plugin isn't working the way you expect, open a bug report with Firebase support so they can investigate. You will want to give very specific information about how you build and run your app, including code. The first issue you show here is not likely a problem. support.google.com/firebase/contact/supportUyekawa
C
1

I had the same issue, and the fix was to move the classpath of the firebase performance before the other plugin that has the dependency to the "org.ow2.asm:asm"(in the project level gradle file).

  dependencies {
    classpath 'com.google.firebase:perf-plugin:1.3.1'
    classpath "org.jacoco:org.jacoco.core:$jacoco_version"
    ...
 }

Firebase plugin uses version 7.0 of the org.ow2.asm:asm Jacoco plugin uses 5.+ of the org.ow2.asm:asm

To check the versions you can try to use ./gradlew buildEnvironment

https://www.gitmemory.com/issue/gradle/gradle/9650/499815877

Maybe you have the same issue as me.

Cuprite answered 6/3, 2020 at 11:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.