Troubleshooting

Solutions for the most common issues when integrating Snapbug.

Network Security Configuration

Android

Starting with Android 9 (API 28), cleartext (non-HTTPS) traffic is blocked by default. Since the Snapbug SDK communicates with the Desktop app over localhost using cleartext HTTP and WebSocket, you need to explicitly allow it.

1. Create a Network Security Config file

Create res/xml/network_security_config.xml in your app module:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="false">localhost</domain>
        <domain includeSubdomains="false">127.0.0.1</domain>
    </domain-config>
</network-security-config>

2. Reference it in AndroidManifest.xml

<application
    android:networkSecurityConfig="@xml/network_security_config"
    ... >
</application>
warning

Do not use cleartextTrafficPermitted="true" at the top level of the config. That would allow cleartext traffic to all domains, which is a security risk. Only allow it for localhost and 127.0.0.1.

info

If you already have a network_security_config.xml for other purposes (e.g., certificate pinning), just add the localhost and 127.0.0.1 domain entries to your existing file.

Debug-only configuration

If you want to restrict this to debug builds only, create separate manifest files:

src/debug/AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
    <application
        android:networkSecurityConfig="@xml/network_security_config" />
</manifest>

Place the network_security_config.xml file in src/debug/res/xml/ instead of src/main/res/xml/.

Device Not Detected

If the Snapbug Desktop app does not detect your device:

  1. Check ADB -- Run adb devices and verify your device is listed.
  2. Check port forwarding -- Run adb forward tcp:9023 tcp:9023 and adb forward tcp:9024 tcp:9024.
  3. Restart ADB -- Run adb kill-server && adb start-server.
  4. Check the app is running -- The SDK only connects when the app with Snapbug initialized is in the foreground.

SDK Not Initializing

  • Verify you called Snapbug.initialize(this) in your Application.onCreate().
  • Ensure the Application class is registered in AndroidManifest.xml via android:name.
  • Check that you are using debugImplementation (not implementation) for the SDK dependency.

Emulator Connection Issues

Emulators should connect automatically since they share localhost with the host machine. If not:

  • Make sure the Desktop app is running before launching the emulator app.
  • Try restarting the Desktop app.
  • Check that no other process is using ports 9023 or 9024.

Wi-Fi Connection Not Working

When connecting over Wi-Fi:

  • Both the device and the computer must be on the same network.
  • Some corporate or guest networks block device-to-device communication. Try a different network or use USB instead.
  • Verify the computer's local IP address is correct (use ifconfig on macOS/Linux or ipconfig on Windows).

ProGuard / R8 Issues

If you encounter issues with minified builds, add this to your ProGuard rules:

-keep class io.snapbug.sdk.** { *; }
-keep class ai.snapbug.** { *; }
info

The no-op variant does not require ProGuard rules since it contains no code that needs to be preserved.