Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled Exception: LateInitializationError: Field 'requestPort' has not been initialized. #885

Closed
bhavykoshti opened this issue Feb 3, 2023 · 16 comments

Comments

@bhavykoshti
Copy link

Describe the bug
When you start the call after ending one call that call is not starting, even the local video view is not starting

To Reproduce
Steps to reproduce the behavior:

  1. Start one call wait for both person to come live
  2. End that call
  3. Start Another call
  4. See error

Expected behavior
When i start another call i should be able to start it normally just like the previous one

Smartphone (please complete the following information):

  • Device: Redmi note 8 Pro, Pixel 6
  • OS: Android
  • Version Android 11 and 13

Additional context

#0      _ApiCallExecutor.requestPort (package:agora_rtc_engine/src/impl/api_caller.dart)
#1      _ApiCallExecutor.callIrisApiWithUin8ListAsync (package:agora_rtc_engine/src/impl/api_caller.dart:280:5)
#2      ApiCaller.callIrisApiWithUin8ListAsync (package:agora_rtc_engine/src/impl/api_caller.dart:99:10)
#3      ApiCaller.callIrisApi (package:agora_rtc_engine/src/impl/api_caller.dart:107:12)
#4      RtcEngineImpl.leaveChannel (package:agora_rtc_engine/src/impl/agora_rtc_engine_impl.dart:759:25)
#5      ChatVideoCallModel.dispose (package:agreed/feature/chat/video_call/video_call_model.dart:152:18)
#6      _runGuarded (package:riverpod/src/framework/container.dart:5:7)
#7      Iterable.forEach (dart:core/iterable.dart:325:35)
#8      ProviderElementBase._runOnDispose (package:riverpod/src/framework/provider_base.dart:909:26)
#9      ProviderElementBase.dispose (package:riverpod/src/framework/provider_base.dart:860:5)
#10     ProviderContainer._disposeProvider (package:riverpod/src/framework/container.dart:354:13)
#11     _ProviderScheduler._performDispose (package:riverpod/src/framework/scheduler.dart:81:26)
#12     _ProviderScheduler._task (package:riverpod/src/framework/scheduler.dart:42:5)
#13     _UncontrolledProviderScopeElement.build (package:flutter_riverpod/src/framework.dart:303:12)
#14     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4878:15)
#15     Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#16     BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2667:19)
#17     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:882:21)
#18     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1175:15)
#19     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1104:9)

E/flutter ( 3742): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: IsolateSpawnException: Unable to spawn isolate: Could not prepare the child

E/flutter ( 3742): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: LateInitializationError: Field 'requestPort' has not been initialized.
#0      _ApiCallExecutor.requestPort (package:agora_rtc_engine/src/impl/api_caller.dart)
#1      _ApiCallExecutor.callIrisApiWithUin8ListAsync (package:agora_rtc_engine/src/impl/api_caller.dart:280:5)
#2      ApiCaller.callIrisApiWithUin8ListAsync (package:agora_rtc_engine/src/impl/api_caller.dart:99:10)
#3      ApiCaller.callIrisApi (package:agora_rtc_engine/src/impl/api_caller.dart:107:12)
#4      RtcEngineImpl.leaveChannel (package:agora_rtc_engine/src/impl/agora_rtc_engine_impl.dart:759:25)
#5      ChatVideoCallModel.dispose (package:agreed/feature/chat/video_call/video_call_model.dart:152:18)
#6      _runGuarded (package:riverpod/src/framework/container.dart:5:7)
#7      Iterable.forEach (dart:core/iterable.dart:325:35)
#8      ProviderElementBase._runOnDispose (package:riverpod/src/framework/provider_base.dart:909:26)
#9      ProviderElementBase.dispose (package:riverpod/src/framework/provider_base.dart:860:5)
#10     ProviderContainer._disposeProvider (package:riverpod/src/framework/container.dart:354:13)
#11     _ProviderScheduler._performDispose (package:riverpod/src/framework/scheduler.dart:81:26)
#12     _ProviderScheduler._task (package:riverpod/src/framework/scheduler.dart:42:5)
#13     _UncontrolledProviderScopeElement.build (package:flutter_riverpod/src/framework.dart:303:12)
#14     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4878:15)
#15     Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#16     BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2667:19)
#17     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:882:21)
#18     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1175:15)
#19     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1104:9)```
@littleGnAl
Copy link
Contributor

Can you share API call logs? There should be something like the below log to the console.

[2023-02-06 15:07:57.542] [84585] [debug] [iris_rtc_engine_impl.cc:112] api name RtcEngine_initialize params {"context":{"appId":"******"}}
[2023-02-06 15:07:57.621] [84585] [debug] [iris_rtc_device_manager_impl.cc:29] IrisRtcDeviceManagerImpl Initialize

@littleGnAl littleGnAl added the waiting for customer response waiting for customer response, or closed by no-reponse bot label Feb 6, 2023
@adiShinwari
Copy link

@bhavykoshti
Hey did you solve it?
I am also getting the same error.

@adiShinwari
Copy link

@littleGnAl hello,
I am also getting the same error on the same steps. I am pasting my logs below.
[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: LateInitializationError: Field 'requestPort' has not been initialized.
#0 _ApiCallExecutor.requestPort (package:agora_rtc_engine/src/impl/api_caller.dart)
api_caller.dart:1
#1 _ApiCallExecutor.callIrisApiWithUin8ListAsync
api_caller.dart:273
#2 ApiCaller.callIrisApiWithUin8ListAsync
api_caller.dart:110
#3 ApiCaller.callIrisApi
api_caller.dart:118
#4 RtcEngineImpl.setupRemoteVideo
agora_rtc_engine_impl.dart:687
#5 VideoViewControllerBaseMixin.disposeRender
video_view_controller_impl.dart:72
#6 _AgoraRtcRenderPlatformViewState._disposeRender
agora_video_view_impl.dart:115
#7 _AgoraRtcRenderPlatformViewState.dispose

@BakhtawarHabib
Copy link

did you resolve it
?

@littleGnAl
Copy link
Contributor

Please check this comment
#860 (comment)

@bhavykoshti
Copy link
Author

This occurs when your initialization is not properly done, Will check in few days if it occurs again, if not then will close this issue

@github-actions github-actions bot removed the waiting for customer response waiting for customer response, or closed by no-reponse bot label Feb 17, 2023
@adiShinwari
Copy link

Resolved from my side

@bhavykoshti
Copy link
Author

What changes have you made? @adiShinwari

@adiShinwari
Copy link

I am creating a single instance of agora rtc at the start of the app using getit package. And I am using it.

@littleGnAl
Copy link
Contributor

I'm addressing a fix here, but I still need more tests before it can be merged.
#905

@hadi7khan
Copy link

I am getting the same error? Video or audio call is not connecting, throwing this error.

@littleGnAl
Copy link
Contributor

This fix #905 has landed main branch

@littleGnAl littleGnAl added the waiting for customer response waiting for customer response, or closed by no-reponse bot label Feb 21, 2023
@abdulkash
Copy link

abdulkash commented Mar 13, 2023

Am getting the same error here is my implementation

`_engine = createAgoraRtcEngine();
await _engine.initialize(RtcEngineContext(
appId: APP_ID,
));
await _engine.enableVideo();

_engine.registerEventHandler(
  RtcEngineEventHandler(
    onJoinChannelSuccess: (RtcConnection connection, int elapsed) async {
      dev.log("Joined live uid => ${connection.localUid}");

      await Wakelock.enable();
    },
    onUserJoined: (RtcConnection connection, int uid, int elapsed) {
      dev.log("Joined live");
      setState(
        () {
          _users.add(LiveUser(id: uid, videoMuted: false, audioMuted: false));
        },
      );
    },
    onUserMuteVideo: (connection, id, mute) {
      setState(() {
        _users[_users.indexWhere((element) => element.id == id)].videoMuted = mute;
      });
    },
    onUserMuteAudio: (connection, uid, mute) {
      setState(() {
        _users[_users.indexWhere((element) => element.id == uid)].audioMuted = mute;
      });
    },
    onUserOffline: (connection, uid, reasonType) {
      // if (uid == guestID) {
      //   setState(() {
      //     accepted = false;
      //   });
      // }
      setState(() {
        _users.removeWhere((element) => element.id == uid);
      });
    },
    onError: (typr, e) {
      dev.log(e.toString());
    },
    onLeaveChannel: (connection, stats) {
      setState(
        () {
          _users.clear();
        },
      );
    },
  ),
);

final viewModel = context.read<LiveViewModel>();
final parsedInviteId = viewModel.parseInviteId(
  widget.inviteId,
);

ChannelMediaOptions options = ChannelMediaOptions(
  clientRoleType: ClientRoleType.clientRoleBroadcaster,
  channelProfile: ChannelProfileType.channelProfileLiveBroadcasting,
);


await _engine.joinChannel(
  token: parsedInviteId['token'],
  channelId: parsedInviteId['channelName'],
  uid: context.read<UserViewModel>().user_id,
  options: options,
);

`

E/flutter (26713): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: LateInitializationError: Field 'requestPort' has not been initialized.
E/flutter (26713): #0 _ApiCallExecutor.requestPort (package:agora_rtc_engine/src/impl/api_caller.dart)
api_caller.dart:1
E/flutter (26713): #1 _ApiCallExecutor.callIrisApiWithUin8ListAsync
api_caller.dart:273
E/flutter (26713): #2 ApiCaller.callIrisApiWithUin8ListAsync
api_caller.dart:110
E/flutter (26713): #3 ApiCaller.callIrisApi
api_caller.dart:118
E/flutter (26713): #4 RtcEngineExImpl.setupRemoteVideoEx
agora_rtc_engine_ex_impl.dart:125
E/flutter (26713): #5 VideoViewControllerBaseMixin.setupView
video_view_controller_impl.dart:120
E/flutter (26713): #6 _AgoraRtcRenderPlatformViewState._setupVideo
agora_video_view_impl.dart:111
E/flutter (26713):

@bhavykoshti
Copy link
Author

bhavykoshti commented Mar 14, 2023

@abdulkash

  agora_rtc_engine:
    git:
      url: https://github.com/AgoraIO-Extensions/Agora-Flutter-SDK.git
      ref: main

instead your library in yaml

@github-actions github-actions bot removed the waiting for customer response waiting for customer response, or closed by no-reponse bot label Mar 14, 2023
@abdulkash
Copy link

@bhavykoshti
am not getting any camera preview from when i initialize the engine, i have enabled video and also start preview when video view is created. and also when i release the engine the spawned isolate still remains

@github-actions
Copy link
Contributor

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please raise a new issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants