Skip to content

Commit

Permalink
fix: [android] Fix reset the log file in RtcEngine.initialize cause i…
Browse files Browse the repository at this point in the history
…ncorrect log file path (#1201)

fix: [android] Fix reset the log file in RtcEngine.initialize cause incorrect log file path (#1201)
  • Loading branch information
littleGnAl authored Jul 11, 2023
1 parent db57e87 commit b437bee
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions lib/src/impl/agora_rtc_engine_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ import 'package:agora_rtc_engine/src/impl/native_iris_api_engine_binding_delegat
import 'package:flutter/foundation.dart'
show ChangeNotifier, defaultTargetPlatform;
import 'package:flutter/services.dart' show MethodChannel;
import 'package:flutter/widgets.dart'
show VoidCallback, TargetPlatform, debugPrint;
import 'package:flutter/widgets.dart' show VoidCallback, TargetPlatform;
import 'package:iris_method_channel/iris_method_channel.dart';
import 'package:meta/meta.dart';

Expand Down Expand Up @@ -259,11 +258,8 @@ class RtcEngineImpl extends rtc_engine_ex_binding.RtcEngineExImpl
_initializingCompleter = Completer<void>();
engineMethodChannel = const MethodChannel('agora_rtc_ng');

String externalFilesDir = '';
if (defaultTargetPlatform == TargetPlatform.android) {
final androidInitResult =
await engineMethodChannel.invokeMethod('androidInit');
externalFilesDir = androidInitResult['externalFilesDir'] ?? '';
await engineMethodChannel.invokeMethod('androidInit');
}

List<int> args = [];
Expand All @@ -284,16 +280,6 @@ class RtcEngineImpl extends rtc_engine_ex_binding.RtcEngineExImpl
jsonEncode({'appType': 4}),
));

if (externalFilesDir.isNotEmpty) {
try {
// Reset the sdk log file to ensure the iris log path has been set
await setLogFile('$externalFilesDir/agorasdk.log');
} catch (e) {
debugPrint(
'[RtcEngine] setLogFile fail, make sure the permission is granted.');
}
}

_rtcEngineState.isInitialzed = true;
_isReleased = false;
_initializingCompleter?.complete(null);
Expand Down

0 comments on commit b437bee

Please sign in to comment.