Overview
This guide helps you resolve common issues when using Scrcpy for Android. Issues are organized by category for quick reference.Connection Timeout Errors
”Connection Timed out 2”
This error appears when the socket connection cannot be established within the timeout period.Possible Causes
Possible Causes
- Target device is not reachable on the network
- Firewall blocking ADB port (5555)
- Wireless debugging not enabled on target device
- Incorrect IP address or port
- Target device went to sleep during connection
Solutions
Solutions
- Verify the target device IP address is correct
- Ensure both devices are on the same network
- Check that wireless debugging is enabled on the target
- Try pinging the target device IP from a terminal
- Restart wireless debugging on the target device
- Keep target device screen on during connection
Connection Timeout During Handshake
If connection starts but times out before showing the screen: Timeout Configuration:- Initial connection: 50 attempts × 100ms = 5 seconds
- Socket timeout: 5000ms (5 seconds)
- Resolution handshake: 10 attempts × 100ms = 1 second
- Manually verify server jar exists on target:
- Check server execution permissions
- Clear
/data/local/tmp/and retry connection - Restart ADB server on both devices
ADB Connection Issues
”Network OR ADB connection failed”
This message indicates the ADB connection or server upload failed.- Network Issues
- ADB Issues
- Permission Issues
Symptoms:
- Cannot reach target device
- Ping fails
- Different network subnets
- Ensure both devices on same Wi-Fi network
- Check for VPN interference
- Disable mobile data during connection
- Try connecting to 5GHz band if available
Repeated Connection Failures
The app automatically restarts the ADB server after 3 consecutive failures.You can see connection attempt counter in logs: “连接错误次数: X” (Connection error count: X)
- Error count increments on each failed connection
- At 3 errors:
App.startAdbServer()is called automatically - Manual disconnect resets counter to 0
- Successful connection resets counter to 0
Network Problems
High Latency
Symptoms:- Slow response to touch input
- Video stuttering
- Audio out of sync
- Check your delay control setting (try “High (100ms)”)
- Monitor Wi-Fi signal strength
- Test with lower resolution/bitrate
| Setting | Value |
|---|---|
| Resolution | 640x360 or 800x448 |
| Bitrate | 1 Mbps |
| Delay Control | High (100ms) |
Packet Loss
Symptoms:- Frequent frame drops
- Blocky video artifacts
- Choppy playback
- Reduce bitrate to 2 Mbps or 1 Mbps
- Lower resolution to reduce bandwidth
- Move closer to Wi-Fi router
- Switch to 5GHz Wi-Fi if available
- Close bandwidth-heavy apps on both devices
Black Screen Issues
Screen Stays Black After Connection
Orientation Mismatch
Orientation Mismatch
The most common cause of black screens is orientation mismatch.What happens:
- App expects portrait, device is landscape (or vice versa)
- Video decoder configured for wrong dimensions
- Surface cannot render mismatched resolution
- Disconnect and return to main screen
- Ensure main screen shows portrait orientation
- Reconnect to device
- Let automatic rotation handle orientation changes
Surface Not Ready
Surface Not Ready
The video surface may not be initialized when decoder starts.Indicators:
- Connection succeeds quickly
- No error messages
- Touch input works but no video
- This is usually transient
- Wait 2-3 seconds
- If persists, disconnect and reconnect
Decoder Configuration Issues
Decoder Configuration Issues
Video decoder may fail to configure with received settings.Check for:
- Unsupported resolution on local device
- SPS/PPS configuration errors
- Codec compatibility issues
- Try different resolution (1280x720 is widely supported)
- Lower bitrate
- Restart both apps
Black Screen After Rotation
Rotation requires careful state management: If black screen occurs after rotation:- Press back button twice to disconnect
- App returns to main screen
- Wait for orientation to stabilize to portrait
- Reconnect
Performance Optimization
Improving Frame Rate
Optimize Resolution
Lower resolution reduces encoding/decoding overhead:
- Start with 1280x720 for good balance
- Reduce to 800x448 if still choppy
- Use 640x360 only for very slow devices
Adjust Bitrate
Match bitrate to network capacity:
- Test with 2 Mbps first
- Increase to 4 Mbps if stable
- Use 6 Mbps only on excellent local networks
Set Appropriate Delay
Balance responsiveness vs. smoothness:
- Low (30ms): Fast networks, prioritizes responsiveness
- Medium (60ms): Default, good balance
- High (100ms): Slow networks, prioritizes smooth playback
Reducing Latency
For minimum input lag:- Network latency: Ping time between devices (check with ping command)
- Encoding delay: Higher resolution = more encoding time
- Decoding delay: Local device performance
- Display delay: Frame buffering based on delay setting
Audio Issues
If audio is choppy or out of sync:- Audio typically follows video delay settings
- If audio lags behind video: Increase delay control
- If audio stutters: Reduce bitrate to lower network load
- If no audio: Check that audio streaming is supported on target device
Server-Side Issues
Server Jar Not Found
If the server keeps re-uploading:- Clear app data on local device
- Reinstall Scrcpy for Android
- Manually push server jar if needed
Port Forwarding Failures
Error symptoms:- Connection hangs at “Connecting…”
- Socket connection fails repeatedly
The app forwards local port 7008 to remote port 7007 automatically during connection setup.
Debugging Tips
Enable Detailed Logging
Monitor logcat for detailed error messages:Common Log Messages
| Log Message | Meaning | Action |
|---|---|---|
| ”Connecting to 127.0.0.1 success” | Socket connected | Normal |
| ”can’t read socket Resolution” | Handshake timeout | Check server execution |
| ”attempts—“ | Retry attempt | Wait or troubleshoot |
| ”Connection Timed out 2” | Connection failed | Check network/ADB |
| ”Network OR ADB connection failed” | Initial setup failed | Verify ADB access |
Manual Connection Test
Test the connection manually to isolate issues:Getting Help
If you’re still experiencing issues:Check Connection Setup
Review connection requirements and process
Review Configuration
Ensure settings are appropriate for your network
Test Control Features
Verify control functionality works correctly
Report Issues
Collect logs and report bugs to the development team
