I'm working on a Flutter project that involves WebRTC functionality using the flutter-webrtc package. However, whenever I try to build the app, it crashes before even launching. I have tried running the app on both Android and iOS devices, but the issue persists. I suspect the problem might be related to the flutter-webrtc package or the WebRTC functionality itself. Can someone please help me troubleshoot this issue and find a solution? Any insights or suggestions would be greatly appreciated.
build.gradle
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 33
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.video_call"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 23
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
debug console:
I/org.webrtc.Logging(27390): NativeLibrary: Loading native library: jingle_peerconnection_so
I/org.webrtc.Logging(27390): NativeLibrary: Loading library: jingle_peerconnection_so
I/org.webrtc.Logging(27390): PeerConnectionFactory: PeerConnectionFactory was initialized without an injected Loggable. Any existing Loggable will be deleted.
I/org.webrtc.Logging(27390): EglBase14Impl: Using OpenGL ES version 2
D/EGL_emulation(27390): eglCreateContext: 0xf1fb5450: maj 2 min 0 rcv 2
2
I/org.webrtc.Logging(27390): WebRtcAudioManagerExternal: Sample rate is set to 44100 Hz
E/org.webrtc.Logging(27390): JavaAudioDeviceModule: HW AEC not supported
E/org.webrtc.Logging(27390): JavaAudioDeviceModule: HW NS not supported
I/org.webrtc.Logging(27390): JavaAudioDeviceModule: createAudioDeviceModule
I/org.webrtc.Logging(27390): JavaAudioDeviceModule: HW NS will not be used.
I/org.webrtc.Logging(27390): JavaAudioDeviceModule: HW AEC will not be used.
I/org.webrtc.Logging(27390): WebRtcAudioEffectsExternal: ctor@[name=main, id=2]
I/org.webrtc.Logging(27390): WebRtcAudioRecordExternal: ctor@[name=main, id=2]
I/org.webrtc.Logging(27390): WebRtcAudioTrackExternal: ctor@[name=main, id=2]
I/VideoCapabilities(27390): Unsupported profile 4 for video/mp4v-es
I/org.webrtc.Logging(27390): PeerConnectionFactory: onNetworkThreadReady
I/org.webrtc.Logging(27390): PeerConnectionFactory: onSignalingThreadReady
I/org.webrtc.Logging(27390): PeerConnectionFactory: onWorkerThreadReady
I/org.webrtc.Logging(27390): EglRenderer: Initializing EglRenderer
I/org.webrtc.Logging(27390): EglRenderer: EglBase.create shared context
D/HostConnection(27390): HostConnection::get() New Host Connection established 0xf1fa14f0, tid 27440
D/HostConnection(27390): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_sync_buffer_data ANDROID_EMU_read_color_buffer_dma GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_2
I/org.webrtc.Logging(27390): EglBase14Impl: Using OpenGL ES version 2
D/EGL_emulation(27390): eglCreateContext: 0xf1fa18e0: maj 2 min 0 rcv 2
W/Gralloc4(27390): allocator 3.x is not supported
I/FlutterWebRTCPlugin(27390): getUserMedia(video): ConstraintsMap{mMap={facingMode=user}}
I/CameraManagerGlobal(27390): Connecting to camera service
D/FlutterWebRTCPlugin(27390): Creating video capturer using Camera2 API.
D/FlutterWebRTCPlugin(27390): Create front camera 1 succeeded
D/EGL_emulation(27390): eglMakeCurrent: 0xf1fa18e0: ver 2 0 (tinfo 0xf22de950) (first time)
D/HostConnection(27390): HostConnection::get() New Host Connection established 0xf1fb3b60, tid 27441
D/HostConnection(27390): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_sync_buffer_data ANDROID_EMU_read_color_buffer_dma GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_2
I/org.webrtc.Logging(27390): EglBase14Impl: Using OpenGL ES version 2
D/EGL_emulation(27390): eglCreateContext: 0xf1fa0290: maj 2 min 0 rcv 2
D/EGL_emulation(27390): eglMakeCurrent: 0xf1fa0290: ver 2 0 (tinfo 0xf22efad0) (first time)
E/EGL_emulation(27390): eglQueryContext 32c0 EGL_BAD_ATTRIBUTE
E/EGL_emulation(27390): tid 27441: eglQueryContext(2019): error 0x3004 (EGL_BAD_ATTRIBUTE)
I/org.webrtc.Logging(27390): CameraCapturer: startCapture: 1280x720@30
D/FlutterWebRTCPlugin(27390): changeCaptureFormat: 1280x720@30
I/org.webrtc.Logging(27390): Camera2Session: Create new camera2 session on camera 1
I/org.webrtc.Logging(27390): Camera2Session: start
D/FlutterWebRTCPlugin(27390): MediaStream id: a1f2e57a-ac2c-47ff-a5ee-6aadce72ccc1
I/org.webrtc.Logging(27390): Camera2Session: Available preview sizes: [1920x1440, 1920x1080, 1920x960, 1600x1200, 1440x1080, 1280x960, 1280x720, 1024x768, 800x600, 720x480, 640x480, 640x360, 352x288, 320x240, 176x144]
I/org.webrtc.Logging(27390): Camera2Session: Available fps ranges: [[15.0:15.0], [7.0:30.0], [15.0:30.0], [30.0:30.0]]
I/org.webrtc.Logging(27390): Camera2Session: Using capture format: 1280x720@[7.0:30.0]
I/org.webrtc.Logging(27390): Camera2Session: Opening camera 1
D/FlutterWebRTCPlugin(27390): CameraEventsHandler.onCameraOpening: cameraName=1
I/org.webrtc.Logging(27390): Camera2Session: Camera opened.
I/org.webrtc.Logging(27390): Camera2Session: Camera capture session configured.
I/org.webrtc.Logging(27390): Camera2Session: Stabilization not available.
I/org.webrtc.Logging(27390): Camera2Session: Using continuous video auto-focus.
I/org.webrtc.Logging(27390): Camera2Session: Camera device successfully started.
I/org.webrtc.Logging(27390): CameraCapturer: Create session done. Switch state: IDLE
I/org.webrtc.Logging(27390): SurfaceTextureHelper: Setting listener to org.webrtc.Camera2Session$CaptureSessionCallback$$ExternalSyntheticLambda0@6de788
D/FlutterWebRTCPlugin(27390): CameraEventsHandler.onFirstFrameAvailable
I/org.webrtc.Logging(27390): EglRenderer: Initializing EglRenderer
I/org.webrtc.Logging(27390): EglRenderer: EglBase.create shared context
D/HostConnection(27390): HostConnection::get() New Host Connection established 0xf1fa21a0, tid 27448
D/HostConnection(27390): HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_sync_buffer_data ANDROID_EMU_read_color_buffer_dma GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_2
I/org.webrtc.Logging(27390): EglBase14Impl: Using OpenGL ES version 2
...