微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

null不是对象评估'InstrumentationConstants_1.InstrumentationConstants.BREADCRUMB_VISIBILITY_CRASHES_ONLY'

如何解决null不是对象评估'InstrumentationConstants_1.InstrumentationConstants.BREADCRUMB_VISIBILITY_CRASHES_ONLY'

当我使用appdynamics对我的React本机应用程序进行检测时,react本机应用程序会收到运行时错误

'null不是对象(评估 'InstrumentationConstants_1.InstrumentationConstants.BREADCRUMB_VISIBILITY_CRASHES_ONLY')'

在我进行集成时,它仍然可以很好地进行集成,但是一旦我检测到该应用程序便停止运行。 整合后我用过

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

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

文件顶部。

还完成了android手动链接的所有步骤。

我这里缺少什么吗?

解决方法

我意识到已经有一段时间了,但是无论如何我都会做出贡献,因为它也可能会帮助其他人。

就我而言,在iOS中导入Instrumentation会导致此错误;在最新版本的@ appdynamics / react-native-agent(撰写本文时为20.7.0版)中,这似乎是一个问题。

我改用本机代码(在AppDelegate.m文件中)初始化AppDynamics,如下所示:

#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;
}

有关更多信息,请查看iOS指南: https://docs.appdynamics.com/display/PRO45/Instrument+an+iOS+Application

此外,我避免通过在运行时(仅在Android中)要求在JavaScript中导入AppDynamics。

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。