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

fix: [android] Fix reset the log file in RtcEngine.initialize cause incorrect log file path #1201

Merged
merged 2 commits into from
Jul 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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