Troubleshooting

Resolve common Android SDK integration issues and errors

Troubleshooting

This guide covers the most common issues developers encounter when integrating StreamLayer into Android applications.

SDK Not Initializing

Symptoms:

  • StreamLayer.initialize() throws exception
  • Initialization succeeds but StreamLayer features unavailable
  • LogCat shows "Missing API key" warnings

Solution:

  1. Verify API key is set via StreamLayer.initialize(context, apiKey)
  2. Ensure initialization happens in your custom Application class onCreate()
  3. Confirm Application class is registered in AndroidManifest.xml: android:name=".YourApplication"
  4. Initialize StreamLayer before creating any StreamLayer UI elements
  5. Check that context passed is the application context, not null

StreamLayer Element Not Appearing

Symptoms:

  • StreamLayerView renders blank
  • View is added but shows nothing
  • Layout preview shows content but runtime is empty

Solution:

  1. Verify parent Fragment is in RESUMED state—StreamLayer needs active lifecycle
  2. Check LayoutInflater is using correct Fragment context, not Activity context
  3. Ensure StreamLayerView has explicit dimensions in XML or layout params
  4. Add margin/padding to verify view is actually rendering (not positioned off-screen)
  5. Test in portrait and landscape—rotation may cause visibility issues

ProGuard/R8 Obfuscation Issues

Symptoms:

  • App crashes with "method not found" after building release APK
  • NoSuchMethodError for StreamLayer methods
  • Works in debug, fails in release builds

Solution:

  1. Add to proguard-rules.pro:
    -keep class com.streamlayer.** { *; }
    -keep interface com.streamlayer.** { *; }
    -keep enum com.streamlayer.** { *; }
  2. Also preserve native methods: -keepclasseswithmembernames class * { native <methods>; }
  3. Test release build on physical device before publishing
  4. Review ProGuard mapping file if crashes occur—check method names
  5. Disable minification temporarily to isolate ProGuard-specific issues

Dependency Conflicts

Symptoms:

  • Gradle sync fails with "Duplicate class" error
  • AndroidX library version conflicts
  • Media3 transitive dependency issues

Solution:

  1. Check for duplicate dependencies using ./gradlew dependencies
  2. Force compatible versions in your build.gradle:
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'androidx.media3:media3-common:1.1.1'
  3. Review StreamLayer's dependencies—they're compatible with AndroidX
  4. Use version alignment: com.google.android.material:material should match AndroidX versions
  5. Run ./gradlew clean build after dependency changes

Build Errors

Symptoms:

  • Gradle sync fails mysteriously
  • "Unable to resolve dependency" errors
  • Minimum SDK version mismatch messages

Solution:

  1. Verify minimum SDK is API 21 or higher—StreamLayer requires API 21+
  2. Update Gradle: ./gradlew wrapper --gradle-version 8.0 (or latest)
  3. Check Android Gradle Plugin version (4.2+ recommended)
  4. Clear Gradle cache: rm -rf ~/.gradle/caches/
  5. Run ./gradlew clean build after clearing cache
  6. Verify JDK version: use JDK 11+ for Gradle 7.0+

Still Need Help?

If you've tried these solutions and still encounter issues, contact our support team at [email protected] with:

  • Full Gradle error logs from ./gradlew build output
  • Android OS version and device info
  • AGP version and Gradle version used

Related