我在尝试运行此代码时遇到此错误。
import 'package:flutter_sms/flutter_sms.dart';
import "dart:async";
String message = "This is a test message!";
List<String> recipents = ["6874171269", "5556787676"];
void _sendSMS(String message, List<String> recipents) async {
String result = await sendSMS(message: message, recipients: recipents)
.catchError((onError) {
print(onError);
});
print(result);
}
void main() {
_sendSMS(message, recipents);
}
出了什么问题: Android Gradle 插件仅支持 Kotlin Gradle 插件版本 1.5.20 及更高版本。 以下依赖项不满足所需版本: 项目 ':flutter_sms' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50
所以我去了 build.gradle 文件。
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
我的 Kotlin 版本已经高于 1.5.20。仍然收到此错误。我该如何解决这个问题?