1

As I instrument my React native application with appdynamics the react native application gets the runtime error

'null is not an object (evaluating 'InstrumentationConstants_1.InstrumentationConstants.BREADCRUMB_VISIBILITY_CRASHES_ONLY')'

As I integrate it remains fine with the integration but as soon as I instument the app stops running. After integration I have used

Instrumentation.start({
  appKey: "AD-AAB-AAY-BHY",
  collectorURL: "https://col.eum-appdynamics.com",
});

and

import { Instrumentation } from "@appdynamics/react-native-agent";

on the top of the file.

Also did all the steps of manual link for android .

Is there something I am missing here?

Payel Dutta
  • 742
  • 10
  • 23

1 Answers1

1

I realize it's been a while, but I'll contribute anyway as it may help other people too.

In my case, importing Instrumentation in iOS caused this error; it seems to be a problem in the latest version of @appdynamics/react-native-agent (version 20.7.0 as of writing).

I instead initialized AppDynamics in native code (in the AppDelegate.m file), as follows:

#import <ADEUMInstrumentation/ADEumInstrumentation.h>

...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  
  ...

  ADEumAgentConfiguration *adeumAgentConfig = [[ADEumAgentConfiguration alloc] initWithAppKey:@"YOUR IOS KEY"];

  // AppDynamics swizzles some methods for making requests and may mess up other libraries; disable automatic instrumentation if it causes problems to you.
  adeumAgentConfig.enableAutoInstrument = NO;

  // Initialize AppDynamics
  [ADEumInstrumentation initWithConfiguration:adeumAgentConfig];

  // Leaving screnshots enabled may cause lag during touches; block screenshots if you experience that.
  [ADEumInstrumentation blockScreenshots];

  ...

  return YES;
}

For more info, check the iOS guide: https://docs.appdynamics.com/display/PRO45/Instrument+an+iOS+Application

Additionally, I avoided importing AppDynamics in javascript by requiring it in runtime, in Android only.

if (Platform.OS === 'android') {
    const { Instrumentation } = require('@appdynamics/react-native-agent');
    const appKey = 'YOUR ANDROID KEY';
    console.log(`Starting AppDynamics with key ${appKey}.`);
    Instrumentation.start({
      appKey,
    });
  }