@appdynamics/react-native-agent

中文文档
26.6.1发布于 2026/06/09Apache-2.0TypeScriptESM + CJS零依赖近 30 天下载 5923

Native instrumentation of iOS and android apps built with react-native.

原始使用文档
文档目录10 节
  1. What does this module do?
  2. Setup
  3. Requirements
  4. Step 0: Eject your app
  5. Step 1: Install the npm package
  6. Step 2: Instrument your application
  7. Step 3: (android only) Add permissions
  8. Usage
  9. Documentation
  10. Manual installation

AppDynamics agent for react-native

Brings full support for the AppDynamics mobile RUM (Real User Monitoring) to react-native applications.

What does this module do?

This module injects the native AppDynamics agents into your application and offers a JavaScript bridge to the Instrumentation management interface.

Setup

Requirements

React Native version 0.6 or above.

(iOS only): Pod target and Xcode deployment target must both be >=11. Find the pod target version in the Podfile located in <your_react_native_app>/ios/.

Step 0: Eject your app

Make sure your app is "ejected". The agent needs a proper application to instrument. It won't work in expo!
See ReactNative Eject Explained for more info.

Step 1: Install the npm package

npm install --save @appdynamics/react-native-agent

Step 2: Instrument your application

node node_modules/@appdynamics/react-native-agent/bin/cli.js install

The command above will modify your build configuration to enable build-time instrumentation of your app. It assumes you've kept the default project structure created with the react-native cli tools. This command may fail if you have made heavy modifications to your android and iOS projects. If so, please refer to the manual installation section of this manual.

Step 3: (android only) Add permissions

Add the following permissions to your app's AndroidManifest.xml (which should be located under android/app/src/main/).

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.your.application">

    // Add the following:
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

    // ...
</manifest>

ℹ️ We need these permissions to allow the agent to limit its activity when resources are scarce.

Usage

First, log into your AppDynamics account, and create a new mobile application. Chose either Android or iOS, it doesn't matter. You will obtain an application key which you will need for the next step.

Start the agent like so:

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

Instrumentation.start({
  appKey: 'YOUR-APP-KEY-HERE',
});

info: You should initialize the agent as soon as possible, ideally in your index.js file.

ℹ️ use_frameworks!

If you are using use_frameworks!, you will also need to add $toggleADEUMRNStaticFramework = true in your Podfile:

// Podfile
platform :ios, '11.0'

$toggleADEUMRNStaticFramework = true

target 'MyApp' do
    use_frameworks!
    // ...
end

Documentation

Read the full API documentation here to learn how to customize the instrumentation.

Manual installation

Most users don't have to do these steps. In most cases, you can use the CLI as described in the setup section. If that didn't work, then follow these steps.

For android, add the following line to your android/build.gradle:

apply from: '../node_modules/@appdynamics/react-native-agent/android/adeum.gradle'

Make sure the file settings.gradle contains a reference to the appdynamics agent module as shown below. This is should have been added automatically when autolinking.

include ':@appdynamics_react-native-agent'
project(':@appdynamics_react-native-agent').projectDir = new File(rootProject.projectDir, '../node_modules/@appdynamics/react-native-agent/android')

Also, android/app/build.gradle should contain a reference to the appdynamics agent module.

dependencies {
    implementation project(':@appdynamics_react-native-agent')
    // ...
}

For iOS, link the appdynamics agent module like any other native module. Read about manual linking here.

版本与发布记录

@appdynamics/react-native-agent 共发布 26 个版本,首次发布于 2019/04/12;过去 12 个月发布了 1 个版本。

版本发布日期距今
26.6.1latest2026/06/094 个月前
25.9.02025/10/061.1 年前
25.2.02025/02/111.7 年前
24.7.12024/11/212 年前
24.7.02024/07/092 年前
24.4.02024/04/082 年前

关于 @appdynamics/react-native-agent 的常见问题

@appdynamics/react-native-agent 是什么?

Native instrumentation of iOS and android apps built with react-native.

如何安装 @appdynamics/react-native-agent?

在项目目录运行 npm install @appdynamics/react-native-agent,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(*)、react-native(*)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@appdynamics/react-native-agent 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@appdynamics/react-native-agent 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@appdynamics/react-native-agent 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.11.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@appdynamics/react-native-agent 可以商用吗?

@appdynamics/react-native-agent 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@appdynamics/react-native-agent 的下载量有多少?

根据 npm 官方下载统计,@appdynamics/react-native-agent 在 2026/10/07 – 2026/11/05 这 30 天内被下载 5,923 次,日均约 197 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@appdynamics/react-native-agent 还在维护吗?

最新版本 26.6.1 发布于 2026/06/09(4 个月前);至今共发布 26 个版本,其中过去 12 个月发布了 1 个;首次发布于 2019/04/12。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。