Reputation: 1
Invalid argument(s): Failed to load dynamic library 'libiris_method_channel.so': dlopen failed: library "libiris_method_channel.so" not found
E/flutter ( 3573): #0 _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:11:43)
E/flutter ( 3573): #1 new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:22:12) E/flutter ( 3573): #2 _loadLib (package:iris_method_channel/src/platform/io/iris_event_io.dart:16:31)
E/flutter ( 3573): #3 new IrisEventIO (package:iris_method_channel/src/platform/io/iris_event_io.dart:26:54) E/flutter ( 3573): #4 IrisMethodChannelInternalIO._execute (package:iris_method_channel/src/platform/io/iris_method_channel_internal_io.dart:421:64) E/flutter ( 3573): #5 _delayEntrypointInvocation. (dart:isolate-patch/isolate_patch.dart:300:17)
E/flutter ( 3573): #6 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
E/flutter ( 3573): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Null check operator used on a null value
E/flutter ( 3573): #0 _HotRestartFinalizer._finalize (package:iris_method_channel/src/platform/io/iris_method_channel_internal_io.dart:155:74) E/flutter ( 3573): #1 _RootZone.runUnaryGuarded (dart:async/zone.dart:1594:10) E/flutter ( 3573): #2 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11) E/flutter ( 3573): #3 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7) E/flutter ( 3573): #4 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:784:19) E/flutter ( 3573): #5 _StreamController._add (dart:async/stream_controller.dart:658:7) E/flutter ( 3573): #6 _StreamController.add (dart:async/stream_controller.dart:606:5) E/flutter ( 3573): #7 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12) E/flutter ( 3573):
import 'dart:convert';
import 'package:flutter/services.dart';
import 'package:agora_rtc_engine/agora_rtc_engine.dart';
import 'package:permission_handler/permission_handler.dart';
import 'dart:async';
import 'package:flutter/material.dart';
class newww extends StatefulWidget {
const newww({Key? key}) : super(key: key);
@override
State<newww> createState() => _newwwState();
}
class _newwwState extends State<newww> {
int? _remoteUid;
bool _localUserJoined = false;
late RtcEngine _engine;
@override
void initState() {
super.initState();
initAgora();
}
Future<void> initAgora() async {
// retrieve permissions
await [Permission.microphone, Permission.camera].request();
//create the engine
_engine = createAgoraRtcEngine();
await _engine.initialize(const RtcEngineContext(
appId: "a28be509a7404ebc9f42459393ba1cfa",
channelProfile: ChannelProfileType.channelProfileLiveBroadcasting,
));
_engine.registerEventHandler(
RtcEngineEventHandler(
onJoinChannelSuccess: (RtcConnection connection, int elapsed) {
debugPrint("local user ${connection.localUid} joined");
setState(() {
_localUserJoined = true;
});
},
onUserJoined: (RtcConnection connection, int remoteUid, int elapsed) {
debugPrint("remote user $remoteUid joined");
setState(() {
_remoteUid = remoteUid;
});
},
onUserOffline: (RtcConnection connection, int remoteUid,
UserOfflineReasonType reason) {
debugPrint("remote user $remoteUid left channel");
setState(() {
_remoteUid = null;
});
},
onTokenPrivilegeWillExpire: (RtcConnection connection, String token) {
debugPrint(
'[onTokenPrivilegeWillExpire] connection: ${connection.toJson()}, token: $token');
},
),
);
await _engine.setClientRole(role: ClientRoleType.clientRoleBroadcaster);
await _engine.enableVideo();
await _engine.startPreview();
await _engine.joinChannel(
token: "007eJxTYDBL3aC4U2Hicl9Vsc4Eo0bx4z8K4u59u6EaeHiuVIObhK8CQ6KRRVKqqYFlormJgUlqUrJlmomRiamlsaVxUqJhclri6dXaaQ2BjAxJsreYGBkgEMRnYShJLS5hYAAAzAceCQ==",
channelId: "test",
uid: 0,
options: const ChannelMediaOptions(),
);
}
@override
void dispose() {
super.dispose();
_dispose();
}
Future<void> _dispose() async {
await _engine.leaveChannel();
await _engine.release();
}
// Create UI with local view and remote view
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Agora Video Call'),
),
body: Stack(
children: [
Center(
child: _remoteVideo(),
),
Align(
alignment: Alignment.topLeft,
child: SizedBox(
width: 100,
height: 150,
child: Center(
child: _localUserJoined
? AgoraVideoView(
controller: VideoViewController(
rtcEngine: _engine,
canvas: const VideoCanvas(uid: 0),
),
)
: const CircularProgressIndicator(),
),
),
),
],
),
);
}
// Display remote user's video
Widget _remoteVideo() {
if (_remoteUid != null) {
return AgoraVideoView(
controller: VideoViewController.remote(
rtcEngine: _engine,
canvas: VideoCanvas(uid: _remoteUid),
connection: const RtcConnection(channelId: "test"),
),
);
} else {
return const Text(
'Please wait for remote user to join',
textAlign: TextAlign.center,
);
}
}
}
Upvotes: 0
Views: 68
Reputation: 630
Here the solution which is working for me (found here: https://github.com/dart-lang/native/issues/897)
1. In Xcode, go to **Target Runner > Build Settings > Strip Style**.
2. Change from **All Symbols** to **Non-Global Symbols**.
Also, this issue happens with a real device and doesn't happen with iPhone emulator.
Upvotes: 0