Dynatrace flutter plugin error

I was unable to make Dynatrace work with the latest version from pub.dev.

I followed all the steps of the documentation, but I’m getting this error while starting the app:

I am pretty sure there is something wrong with the method channel implementation of the plugin.

java.lang.NullPointerException: Attempt to read from field ‘boolean com.dynatrace.android.agent.conf.Configuration.autoStart’ on a null object reference in method ‘void com.dynatrace.android.agent.DynatraceMethodCallHandler.onMethodCall(io.flutter.plugin.common.MethodCall, io.flutter.plugin.common.MethodChannel$Result)’
E/MethodChannel#dynatrace_flutter_plugin/dynatrace(26848): at com.dynatrace.android.agent.DynatraceMethodCallHandler.onMethodCall(DynatraceMethodCallHandler.java:120)
E/MethodChannel#dynatrace_flutter_plugin/dynatrace(26848): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:258)
E/MethodChannel#dynatrace_flutter_plugin/dynatrace(26848): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/MethodChannel#dynatrace_flutter_plugin/dynatrace(26848): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322)
E/MethodChannel#dynatrace_flutter_plugin/dynatrace(26848): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/MethodChannel#dynatrace_flutter_plugin/dynatrace(26848): at android.os.Handler.handleCallback(Handler.java:942)
E/MethodChannel#dynatrace_flutter_plugin/dynatrace(26848): at android.os.Handler.dispatchMessage(Handler.java:99)
E/MethodChannel#dynatrace_flutter_plugin/dynatrace(26848): at android.os.Looper.loopOnce(Looper.java:201)
E/MethodChannel#dynatrace_flutter_plugin/dynatrace(26848): at android.os.Looper.loop(Looper.java:288)
E/MethodChannel#dynatrace_flutter_plugin/dynatrace(26848): at android.app.ActivityThread.main(ActivityThread.java:7872)
E/MethodChannel#dynatrace_flutter_plugin/dynatrace(26848): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#dynatrace_flutter_plugin/dynatrace(26848): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/MethodChannel#dynatrace_flutter_plugin/dynatrace(26848): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

Hi Rodrigo,

This error sounds like auto instrumentation didnt happen. Did you execute the CLI command, so your configuration gets written into the gradle file?

Hey Matthias, thanks for the reply.

I don’t know whats that CLI command. I saw nothing about that on the Flutter Documentation here: dynatrace_flutter_plugin | Flutter package

All i did was store the dynatrace yaml file on the root folder of the project like it was written in the documentation.

I meant the command “flutter pub run dynatrace_flutter_plugin”.

OMG. I completed missed this step on the documentation. So sorry.

Now everything is working fine! Thanks a lot!