Home » Android » android – CrashlyticsCore: Cannot invoke method: registerOnMeasurementEventListener

android – CrashlyticsCore: Cannot invoke method: registerOnMeasurementEventListener

Posted by: admin May 14, 2020 Leave a comment

Questions:

I’ve installed the android firebase performance library and I can see app speed, etc. in the dashboard but the network request monitoring doesn’t seem to be working.

I am getting this error in the logcat:

W/CrashlyticsCore: Cannot invoke method: registerOnMeasurementEventListener
java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at com.crashlytics.android.core.DefaultAppMeasurementEventListenerRegistrar.invoke(DefaultAppMeasurementEventListenerRegistrar.java:94)
    at com.crashlytics.android.core.DefaultAppMeasurementEventListenerRegistrar.register(DefaultAppMeasurementEventListenerRegistrar.java:54)
    at com.crashlytics.android.core.CrashlyticsController.registerAnalyticsEventListener(CrashlyticsController.java:1574)
    at com.crashlytics.android.core.CrashlyticsCore.doInBackground(CrashlyticsCore.java:322)
    at com.crashlytics.android.core.CrashlyticsCore.doInBackground(CrashlyticsCore.java:44)
    at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:63)
    at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:28)
    at io.fabric.sdk.android.services.concurrency.AsyncTask$2.call(AsyncTask.java:311)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
    at java.lang.Thread.run(Thread.java:764)
 Caused by: java.lang.RuntimeException: Unexpected AppMeasurement.OnEventListener signature
    at com.crashlytics.android.core.DefaultAppMeasurementEventListenerRegistrar$1.invoke(DefaultAppMeasurementEventListenerRegistrar.java:120)
    at java.lang.reflect.Proxy.invoke(Proxy.java:913)
    at $Proxy1.equals(Unknown Source)
    at java.util.concurrent.CopyOnWriteArrayList.indexOf(CopyOnWriteArrayList.java:196)
    at java.util.concurrent.CopyOnWriteArrayList.addIfAbsent(CopyOnWriteArrayList.java:590)
    at java.util.concurrent.CopyOnWriteArraySet.add(CopyOnWriteArraySet.java:262)
    at com.google.android.gms.internal.measurement.zzhm.registerOnMeasurementEventListener(Unknown Source:11)
    at com.google.android.gms.measurement.AppMeasurement.registerOnMeasurementEventListener(Unknown Source:6)
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.crashlytics.android.core.DefaultAppMeasurementEventListenerRegistrar.invoke(DefaultAppMeasurementEventListenerRegistrar.java:94) 
    at com.crashlytics.android.core.DefaultAppMeasurementEventListenerRegistrar.register(DefaultAppMeasurementEventListenerRegistrar.java:54) 
    at com.crashlytics.android.core.CrashlyticsController.registerAnalyticsEventListener(CrashlyticsController.java:1574) 
    at com.crashlytics.android.core.CrashlyticsCore.doInBackground(CrashlyticsCore.java:322) 
    at com.crashlytics.android.core.CrashlyticsCore.doInBackground(CrashlyticsCore.java:44) 
    at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:63) 
    at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:28) 
    at io.fabric.sdk.android.services.concurrency.AsyncTask$2.call(AsyncTask.java:311) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) 
    at java.lang.Thread.run(Thread.java:764) 

Any ideas?

Thanks!

How to&Answers:

Double check that

apply plugin: 'com.google.firebase.firebase-perf'

is under

apply plugin: 'com.android.application'

in in your build.grade