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.
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.ktsplugins {
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.ktsdependencies {
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.
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.ktsdependencies {
debugImplementation(
"io.github.devscenario:httpinterceptor:0.2.10"
)
}
src/debug/… where you build OkHttpClient
OkHttpClient.Builder()
.addInterceptor(authInterceptor)
.addInterceptor(NetworkLogInterceptor()) // last
.build()
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 see | Why, 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 found | The 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 starts | Your app has product flavors, so the debug variant is called e.g. freeDebug and debug = true matches nothing. List the variants — snippet. |
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 URL | Product |
|---|---|
https://github.com/devscenario/app-instrumentation-ios.git | DevtoolAppInstrumentation |
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 URL | Product |
|---|---|
https://github.com/devscenario/httpinterceptor-ios.git | DevtoolE2eInterceptor (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.
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.yamldependencies:
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
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:
| Library | Kept out of release by |
|---|---|
| Android SDK | The 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 interceptor | Auto plugin: only touches the variants you allow (debug by default). Manual: debugImplementation. |
| iOS SDK | Your #if DEBUG around start(). |
| iOS interceptor | Manual: your #if DEBUG. Automatic: not linking it into the App Store target. |
| Flutter SDK | Your kDebugMode check around start(). |
Testing an optimized staging or QA build on purpose? On Android, list it: variants("debug", "stagingRelease").