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,
});
}