Dev Scenario Docs Beta
Set up your app / Library setup

Library setup

Both libraries are optional. Dev Scenario drives any app without them. Add them to your debug build when you want:

  • In-app SDK: Espresso-speed runs (the driver runs inside your app). Why it's faster
  • Network interceptor: see and mock your app's requests in the Network tab. What it does

You can add one, the other, or both. For each library, follow one of the ways shown — they are alternatives, not steps.

Tip: the desktop app shows copy-ready snippets with the current versions under Network → Setup.

Android

Versions on Maven Central: 0.2.10 for all four artifacts below.

In-app SDK — pick one

Gradle plugin Recommended

Adds the SDK to the variants you choose. Don't add the dependency as well.

app/build.gradle.kts
plugins {
    id("com.android.application")
    id("io.github.devscenario.app-instrumentation") version "0.2.10"
}

devtoolInstrumentation {
    debug = true       // default
    release = false    // default
}

Plain dependency

One line, debug builds only. No plugin needed.

app/build.gradle.kts
dependencies {
    debugImplementation(
        "io.github.devscenario:app-instrumentation:0.2.10"
    )
}

No code to add: the SDK starts itself when the debug app launches, listening on 127.0.0.1:7755 on the device. Then switch Driver settings to the in-app SDK.

Network interceptor — pick one

Auto plugin Recommended

Wires every OkHttpClient in your app and adds the library for you. No code, no dependency line.

app/build.gradle.kts
plugins {
    id("com.android.application")   // keep it first
    id("io.github.devscenario.httpinterceptor.auto") version "0.2.10"
}

httpInterceptor {
    debug = true       // default
    release = false    // default
}

Manual

Add the library and register the interceptor yourself — useful when you only want it on some clients.

app/build.gradle.kts
dependencies {
    debugImplementation(
        "io.github.devscenario:httpinterceptor:0.2.10"
    )
}
src/debug/… where you build OkHttpClient
OkHttpClient.Builder()
    .addInterceptor(authInterceptor)
    .addInterceptor(NetworkLogInterceptor()) // last
    .build()
Manual setup and release builds: with debugImplementation, the class only exists in debug builds, so code in src/main that mentions NetworkLogInterceptor won't compile for release — an if (BuildConfig.DEBUG) check doesn't help. Put that line in src/debug/ (with a no-op version in src/release/), or use the auto plugin.

Your app keeps its own OkHttp version. No network security config change is needed.

When you need extra Gradle setup

On a standard Android Studio project the snippets above work as they are. Whether you need more depends on how your project is set up — which is why one project needed extra blocks and another didn't. Find your case:

You seeWhy, and the fix
“Plugin [id: 'io.github.devscenario…'] was not found”Your settings.gradle(.kts) plugin repositories don't include Maven Central (common when only google() or a company mirror is listed). Add it — snippet.
“…must include a version number”You applied the plugin without version, which is common in multi-module projects and version catalogs. Declare the version once — snippet.
Your project uses buildscript { classpath … } and apply plugin:Older setup style; the plugins { } lines don't apply. Use the classpath form — snippet.
The SDK or interceptor library can't be foundThe dependency repositories (dependencyResolutionManagement) don't include Maven Central. Add mavenCentral() there too.
“…requires the Android Application or Library plugin”The interceptor plugin is applied before the Android plugin. Move com.android.application above it.
Builds fine, but nothing is captured or the SDK never startsYour app has product flavors, so the debug variant is called e.g. freeDebug and debug = true matches nothing. List the variants — snippet.
settings.gradle.kts — repositories
pluginManagement {
    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }
}
dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
    }
}
build.gradle.kts (root) — declare versions once
plugins {
    id("com.android.application") version "<your AGP version>" apply false
    id("io.github.devscenario.app-instrumentation") version "0.2.10" apply false
    id("io.github.devscenario.httpinterceptor.auto") version "0.2.10" apply false
}
// then in app/build.gradle.kts: id("io.github.devscenario.httpinterceptor.auto") — no version

Using a version catalog? Add the plugins to gradle/libs.versions.toml and apply them with alias(…):

[plugins]
devscenario-instrumentation = { id = "io.github.devscenario.app-instrumentation", version = "0.2.10" }
devscenario-interceptor = { id = "io.github.devscenario.httpinterceptor.auto", version = "0.2.10" }
Older projects (Groovy, buildscript)
// build.gradle (root)
buildscript {
    repositories { google(); mavenCentral() }
    dependencies {
        classpath "com.android.tools.build:gradle:<your AGP version>"
        classpath "io.github.devscenario:app-instrumentation-gradle-plugin:0.2.10"
        classpath "io.github.devscenario:httpinterceptor-auto:0.2.10"
    }
}

// app/build.gradle
apply plugin: 'com.android.application'
apply plugin: 'io.github.devscenario.app-instrumentation'
apply plugin: 'io.github.devscenario.httpinterceptor.auto'
app/build.gradle.kts — apps with product flavors
devtoolInstrumentation { variants("freeDebug", "paidDebug") }
httpInterceptor { variants("freeDebug", "paidDebug") }

iOS

Swift Package Manager, iOS 13 or later. Current version: 0.2.8. CocoaPods isn't supported.

In-app SDK

In Xcode: File → Add Package Dependencies…, enter the URL, and add the product to your app target.

Package URLProduct
https://github.com/devscenario/app-instrumentation-ios.gitDevtoolAppInstrumentation
Start it once, in debug builds only
import DevtoolAppInstrumentation

@main
struct MyApp: App {
    init() {
        #if DEBUG
        DevtoolAppInstrumentation.start()
        #endif
    }
    var body: some Scene { WindowGroup { ContentView() } }
}

Then choose the in-app SDK for iOS in Driver settings. Works on simulators and real iPhones.

Network interceptor — pick one product

Package URLProduct
https://github.com/devscenario/httpinterceptor-ios.gitDevtoolE2eInterceptor (manual)
DevtoolE2eInterceptorAuto (automatic)

Manual Recommended

You decide when it runs, so it's easy to keep out of release builds.

import DevtoolE2eInterceptor

#if DEBUG
URLProtocol.registerClass(NetworkLogInterceptor.self)
#endif

For your own URLSession configurations, add NetworkLogInterceptor.self to protocolClasses.

Automatic

Link the product and every URLSession is captured — no code.

Heads up: it's active in every configuration it's linked into, including release. Use it only in a target or scheme that never ships to the App Store.

Add this to Info.plist so the app may talk to Dev Scenario on your Mac:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsLocalNetworking</key><true/>
</dict>

On a simulator that's all. On a real iPhone, point the interceptor at your Mac: NetworkLogInterceptor.serverHost = "<your Mac's IP>".

Flutter

Pure Dart packages — no Android or iOS project changes. Flutter 3.16+.

In-app SDK

pubspec.yaml
dependencies:
  devscenario_app_instrumentation: ^0.3.1
lib/main.dart
import 'package:devscenario_app_instrumentation/devscenario_app_instrumentation.dart';
import 'package:flutter/foundation.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  if (kDebugMode) DevtoolAppInstrumentation.start();
  runApp(const MyApp());
}

Network interceptor

Coming soon to pub.dev. The Flutter interceptor (devscenario_e2e_interceptor) captures dart:io, package:http and dio traffic. It isn't published yet; this section will get the install line as soon as it is.

Release builds

Everything above is set up for debug builds. Here's what keeps each library out of what you ship:

LibraryKept out of release by
Android SDKThe plugin's or debugImplementation's debug-only default. Even if a release build links it, it stays off unless the app is debuggable or the manifest opts in.
Android interceptorAuto plugin: only touches the variants you allow (debug by default). Manual: debugImplementation.
iOS SDKYour #if DEBUG around start().
iOS interceptorManual: your #if DEBUG. Automatic: not linking it into the App Store target.
Flutter SDKYour kDebugMode check around start().

Testing an optimized staging or QA build on purpose? On Android, list it: variants("debug", "stagingRelease").

Previous
← How it drives your app
Next
Command reference →