Flutter エージェントのインストゥルメント化
Flutter エージェントをインストゥルメント化するには、次の手順を実行します。
- プロジェクトに Flutter エージェントを追加します。
flutter pub add appdynamics_agent - アプリケーションの開始時にインストゥルメンテーションを開始します(通常は main.dart 内)。
import 'package:appdynamics_agent/appdynamics_agent.dart'; import 'package:flutter/material.dart'; Future<void> main() async { WidgetsFlutterBinding.ensureInitialized(); final config = AgentConfiguration( appKey: "<EUM_APP_KEY>", loggingLevel: LoggingLevel.verbose, // optional, for better debugging. collectorURL: "<COLLECTOR_URL>", // optional, mostly on-premises. screenshotURL: "<SCREENSHOT_URL>" // optional, mostly on-premises. ); await Instrumentation.start(config); runApp(const MyApp()); } - (Android アプリケーションのみ)次の設定を追加します。
- android/build.gradle に次の変更を追加します。
dependencies { classpath "com.appdynamics:appdynamics-gradle-plugin:24.12.0" // ... other dependencies } - adeum プラグインを android/app/build.gradle ファイルの下部に適用します。
dependencies { // ... project dependencies } // Bottom of file apply plugin: 'adeum' - AndroidManifest.xml ファイル(通常はandroid/src/main/内)に次の権限を追加します。
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.myawesomepackage"> <!-- add these two permissions --> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <application> <!-- other settings -->
- android/build.gradle に次の変更を追加します。