Skip to content

Build and Application Entry Points

星冉 edited this page Jul 23, 2026 · 3 revisions

Build and Application Entry Points

中文

Last updated: 2026-07-23

Current build baseline

Item Current value Source of truth
Gradle 9.5.0 gradle/wrapper/gradle-wrapper.properties
Android Gradle Plugin 9.3.0 gradle/libs.versions.toml
Kotlin 2.4.10 gradle/libs.versions.toml
Java/Kotlin target 21 app/build.gradle.kts
Android SDK compileSdk 37 / targetSdk 37 / minSdk 23 app/build.gradle.kts
Build Tools 37.0.0 app/build.gradle.kts
NDK 30.0.15729638 Build scripts in the app and external/dadb/dadb-android.
CMake 4.1.2 Build scripts in the app and external/dadb/dadb-android.
C++ C++17 app/build.gradle.kts
scrcpy server 4.1 with pinned SHA-256 app/build.gradle.kts
Telemetry endpoint TELEMETRY_BASE_URL Gradle property embedded in BuildConfig gradle.properties, app/build.gradle.kts

Version numbers on this page are read from current build files, never inferred from old wiki text.

Project structure

Screen-Remote/settings.gradle.kts defines one :app Android application module and uses includeBuild("../external/dadb") to substitute local included-build projects for dev.mobile:dadb and dev.mobile:dadb-android.

The build also:

  • builds the dadb device helper and synchronizes its JAR into app-generated assets;
  • produces ABI outputs for arm64-v8a, armeabi-v7a, x86, and x86_64, plus a universal APK;
  • verifies the bundled scrcpy server SHA-256 before preBuild and check; and
  • builds the JNI code under app/src/main/cpp/ through CMake.

Common commands

Run from the Screen-Remote/ app subrepository:

./gradlew assembleDebug
./gradlew testDebugUnitTest
./gradlew :app:verifyScrcpyServerVersion

assembleDebug validates a complete debug APK build. testDebugUnitTest runs local JVM tests. For a boundary-specific change, run focused tests first, then broaden to the full unit suite and debug build.

updateScrcpyServer downloads and verifies the server declared in the build file. It is an explicit dependency-update action, not part of routine builds.

SDK and included build

Both the app and external/dadb/dadb-android are Android Gradle projects. If command-line builds succeed but IDE sync reports an SDK location error, inspect:

  • Screen-Remote/local.properties
  • external/dadb/local.properties

Both should identify the same Android SDK. Local SDK paths are developer-environment values; do not publish personal paths as wiki facts or commit them.

Android entry points

Entry point Responsibility
app/ScreenRemoteApp.kt Initializes logging and the telemetry journal, settings observation, haptics, local decoder cache, dadb runtime root, ADB connection management, and mDNS discovery.
app/MainActivity.kt Configures edge-to-edge, theme, and language, accepts browsable screen-remote:// Intents in singleTask mode, and hosts MainScreen plus the optional debug-log overlay.
feature/session/ui/MainScreen.kt Top-level Compose routing for session/action tabs, settings pages, management pages, and remote display.
service/ScrcpyForegroundService.kt Coordinates an active remote session with Android foreground lifetime.

AndroidManifest.xml registers ScreenRemoteApp, MainActivity, ScrcpyForegroundService, and FileProvider and declares the current platform capabilities for networking, foreground services, USB Host, overlays, and related behavior. The debug manifest additionally registers a read-only diagnostics provider protected by android.permission.DUMP; it is not packaged in release builds.

What a successful build proves

A built APK proves the compile, resource, native, and packaging paths. It does not replace device validation for:

  • USB permission, TCP reachability, or Wireless Debugging pairing/connection;
  • scrcpy server startup, socket order, metadata, and decoder output; or
  • touch, audio, clipboard, Surface switching, and foreground/background lifecycle.

The canonical page for each subsystem owns those acceptance checks.

Clone this wiki locally