How to Connect with NativeBridge Using ADB: Advanced Testing Capabilities in Your Browser
![NativeBridge ADB Connection Header Image]
Introduction
NativeBridge revolutionizes mobile app testing by bringing native mobile apps directly to your browser. While our browser-based interface is powerful on its own, power users can take testing to the next level by connecting their local development environment directly to NativeBridge's remote devices using the Android Debug Bridge (ADB).
This guide will walk you through establishing an ADB connection with devices running in NativeBridge, opening up advanced testing and debugging capabilities that seamlessly bridge your local development environment with our cloud-hosted devices.
What is ADB and Why Use It with NativeBridge?
Android Debug Bridge (ADB) is a versatile command-line tool that enables direct communication between your development machine and Android devices. When combined with NativeBridge, ADB unlocks powerful capabilities:
- Run automated tests directly against remote devices
- Push and pull files between your local machine and the remote device
- Install APKs directly from your development pipeline
- Access device logs for deeper debugging
- Use tools like scrcpy for enhanced device control
Prerequisites
Before getting started, ensure you have:
- An active NativeBridge account with a running device session
- ADB installed on your local machine
- For Windows: Install via Android Studio or download the Platform Tools directly
- For macOS: Install via
brew install android-platform-tools
- For Linux: Install via your package manager or download Platform Tools
Connecting to a NativeBridge Device via ADB
Step 1: Launch Your Device Session
Start by launching a device session in NativeBridge. This can be either an emulated device or a real physical device.
Step 2: Access the ADB Connection Details
- In your active device session, locate and click the "Connect With ADB" button in the device control panel.
- A modal will appear displaying a connection command in the format:
adb connect <deviceURL>
- This URL is a unique identifier for your specific device session.
![Screenshot of NativeBridge ADB connection modal]
Step 3: Establish the ADB Connection
- Copy the entire
adb connect <deviceURL>
command from the modal. - Open your terminal or command prompt.
- Paste and execute the command:
- If successful, you should see a confirmation message:
connected to device-id-12345.devices.nativebridge.io:7000
Step 4: Verify the Connection
To confirm your device is properly connected, run:
You should see your NativeBridge device listed in the output, showing the status as "device":
Leveraging scrcpy for Enhanced Control
While NativeBridge provides a full browser-based interface, you can also use scrcpy (screen copy) for an alternative way to view and control your remote device with potentially lower latency.
Setting Up scrcpy
- Install scrcpy on your local machine:
- For Windows: Use Chocolatey:
choco install scrcpy
- For macOS: Use Homebrew:
brew install scrcpy
- For Linux: Use your package manager (e.g.,
apt install scrcpy
)
- For Windows: Use Chocolatey:
Connecting with scrcpy
- With your ADB connection established, run the following command:
- A new window will open displaying your remote device screen, which you can control using your mouse and keyboard.
Common ADB Commands for NativeBridge Testing Workflows
Once connected, you can use standard ADB commands to interact with your NativeBridge device:
Installing Apps
Pushing Files
Pulling Files (like screenshots or logs)
Running Shell Commands
Capturing a Screen Recording
(Press Ctrl+C to stop recording, then pull the file to your local machine)
Troubleshooting ADB Connections
Connection Refused or Timeout
If you encounter connection issues:
- Ensure your NativeBridge session is active and not timed out
- Try restarting ADB with:
- Attempt the connection again
Device Unauthorized
If your device shows as "unauthorized":
- Disconnect the device:
adb disconnect <deviceURL>
- Restart your NativeBridge session
- Reconnect using the new connection details
Port Already in Use
If you see "port already in use" errors:
- Check for processes using the port:
netstat -ano | findstr :<PORT>
(Windows) orlsof -i :<PORT>
(macOS/Linux) - Kill the conflicting process and try again
Benefits for Team Collaboration
ADB connectivity in NativeBridge bridges the gap between individual developers and your broader team:
- Developers can run automated tests against shared devices without needing physical access
- QA Engineers can verify issues identified in browser sessions using advanced ADB diagnostics
- DevOps can integrate NativeBridge devices into CI/CD pipelines via ADB connections
Conclusion
By connecting to NativeBridge devices using ADB, you combine the convenience of browser-based testing with the power and flexibility of local development tools. This hybrid approach gives you the best of both worlds: the accessibility of cloud testing with the capabilities of local device testing.
Start integrating NativeBridge's remote devices into your development workflow today, and experience a new level of efficiency in mobile app testing and debugging.
Note: NativeBridge sessions have standard timeout periods. For extended ADB connection sessions, consider upgrading to our Enterprise plan which offers dedicated devices with customizable timeout settings.
Have questions about ADB connectivity with NativeBridge? Contact our support team at [email protected].