我在代码中使用“flutter_launch 0.2.0”时出现以下错误
import 'package:flutter/material.dart';
import 'package:flutter_launch/flutter_launch.dart';
void main() => runApp(new MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => new _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
initState() {
super.initState();
}
void whatsAppOpen() async {
await FlutterLaunch.launchWathsApp(phone: "5534992016545", message: "Hello");
}
@override
Widget build(BuildContext context) {
return new MaterialApp(
home: new Scaffold(
appBar: new AppBar(
title: new Text('Plugin example app'),
),
body: new Center(
child: FlatButton(
child: Text("Open WhatsApp"),
onPressed: () {
whatsAppOpen();
},
)
),
),
);
}
}
失败:生成失败,发生异常。
Android Gradle插件仅支持Kotlin Gradle插件1.3.10及更高版本。
以下依赖项不满足要求的版本:
项目':flutter_launch'-> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71
使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行,以获取更多日志输出。与--scan一起运行以获取完整的见解。
2秒内失败
异常:Gradle任务assembleDebug失败,退出代码为1
我的 Kotlin 课是这个
buildscript {
ext.kotlin_version = '1.3.10'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.3'
}
}
请告诉我为什么会这样。
最佳答案
kotlin-gradle-plugin
版本build:gradle
版本DEMO
buildscript {
ext.kotlin_version = '1.3.72'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.3'
}
}
并打开
gradle-wrapper.properties
并升级gradle版本。distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
关于android - 错误:Android Gradle插件仅支持Kotlin Gradle插件1.3.10及更高版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62319285/