Prerequisites
Before you begin, ensure you have the following tools installed:Android Studio
Latest stable version (Arctic Fox or newer)
JDK 11+
Java Development Kit version 11 or higher
Android SDK
API Level 21 (Lollipop) through API Level 31
Git
For version control
SDK Requirements
The project requires the following Android SDK components:- Min SDK Version: 21 (Android 5.0 Lollipop)
- Target SDK Version: 31 (Android 12)
- Compile SDK Version: 31
Cloning the Repository
Clone the repository and navigate to the project directory:Make sure you have sufficient disk space (at least 2GB) for the Android SDK and build outputs.
Project Structure
Scrcpy for Android is organized as a multi-module Gradle project:Key Modules
app
app
The main Android application that runs on the controlling device. It handles:
- User interface and input
- ADB connection management
- Display rendering
- Touch event forwarding
org.client.scrcpyserver
server
The server component that gets deployed to the target device. It handles:
- Screen capture via MediaCodec
- Touch event injection
- Device control operations
org.server.scrcpyThe server is built as an APK and copied to app/src/main/assets/scrcpy-server.jar.Building the Project
Using Android Studio
-
Import the Project
- Open Android Studio
- Select “Open an Existing Project”
- Navigate to the cloned repository directory
- Click “OK” and wait for Gradle sync to complete
-
Configure Build Variant
- Open “Build Variants” panel (usually on the left side)
- Select
scrcpyDebugfor development orscrcpyReleasefor production builds
-
Build the Application
- Click “Build” → “Make Project” (Ctrl+F9 / Cmd+F9)
- Or click “Build” → “Build Bundle(s) / APK(s)” → “Build APK(s)“
Using Command Line
The project uses Gradle 8.6. Build both modules using the Gradle wrapper:Build Process Details
The build process follows these steps:-
Server Module Build (
server:assembleDebugorserver:assembleRelease)- Compiles AIDL interfaces
- Builds server APK
-
Server Copy Task (
server:copyServer)- Copies the built server APK to
app/src/main/assets/ - Renames it to
scrcpy-server.jar
- Copies the built server APK to
-
App Module Build (
app:assembleDebugorapp:assembleRelease)- Compiles application code
- Packages resources and assets (including server JAR)
- Generates final APK
Running on Device/Emulator
Install via Android Studio
- Connect your Android device via USB or start an emulator
- Enable Developer Options and USB Debugging on your device
- Click the “Run” button (green triangle) or press Shift+F10
- Select your target device from the deployment dialog
Install via Command Line
Testing the App
To test the screen mirroring functionality:-
Prepare Target Device
- Ensure both devices are on the same local network
- Enable “ADB over Network” or “Wireless ADB” on the target device
- Note the IP address (usually shown in Developer Options)
-
Connect
- Open Scrcpy for Android on your controlling device
- Enter the target device IP address
- Select display parameters (1280x720 @ 2Mbps recommended)
- Tap “Start”
-
Accept ADB Prompt
- Accept the ADB connection prompt on the target device
- Check “Always allow from this computer” for convenience
Debugging Tips
Logcat Filtering
Use Android Studio’s Logcat or adb to filter logs:Common Build Issues
Gradle sync failed
Gradle sync failed
Solution:
- Check your internet connection
- Invalidate caches: File → Invalidate Caches / Restart
- Ensure JDK 11+ is configured in Android Studio settings
Server JAR not found
Server JAR not found
Solution:Verify the file exists at
app/src/main/assets/scrcpy-server.jarNative library loading errors
Native library loading errors
Solution:
- Ensure all ABIs are present in
app/src/main/jniLibs/ - Check that native libraries match your device architecture
- Clean and rebuild:
./gradlew clean assembleDebug
Signing configuration errors
Signing configuration errors
Solution:
- For debug builds, signing is automatic
- For release builds, either:
- Create
local.propertieswith signing credentials - Set environment variables before building
- Or modify
app/build.gradleto remove signing requirement
- Create
Enable Verbose Logging
Add togradle.properties:
Debugging Native Code
If working with JNI libraries:- Install LLDB debugger in Android Studio SDK Manager
- Set breakpoints in native code
- Run app in debug mode with Native debugger attached
Next Steps
Once your environment is set up:Read Guidelines
Learn about code style and contribution workflow
Explore Architecture
Understand the application architecture
