Problem
A developer is experiencing multiple issues while integrating the Agora RTM SDK (version 2.2.2) into a Flutter project. Despite following the official integration guidelines, the build consistently fails with several errors, including Unresolved classes such as AgoraRtmClient, AgoraRtmChannel, and RtmMessage, Type assignment mismatches, and issues related to the AndroidManifest configuration.
The developer has already attempted the following troubleshooting steps:
- Confirmed that the Flutter environment is on an official release channel
- Removed or modified the package attribute in the AndroidManifest.xml files
- Tested multiple combinations of Flutter and Dart SDK versions
- Reviewed the official Agora documentation and similar issues reported on GitHub
- Maintained a local copy of the Agora RTM SDK (version 2.2.2) and attempted to reference it directly within the project
Despite these efforts, the issues persist. Assistance was needed to diagnose the root cause and provide guidance on how to successfully integrate the Agora RTM SDK into the Flutter environment.
Errors Encountered
"Target of URI doesn't exist: 'package:agora_rtm/agora_rtm.dart'."
Kotlin compilation errors during task :agora_rtm:compileDebugKotlin.
Unresolved class and type errors for AgoraRtmClient, AgoraRtmChannel, and RtmMessage.
Root Cause
From customer's code, the package hasn’t been imported correctly in his Dart file.
Solution
The developer needs to ensure that they are importing the Agora RTM package correctly in their Dart files.
import 'package:agora_rtm/agora_rtm.dart';