Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 从颤振应用程序启动Whatsapp时出现问题_Android_Flutter_Flutter Dependencies - Fatal编程技术网

Android 从颤振应用程序启动Whatsapp时出现问题

Android 从颤振应用程序启动Whatsapp时出现问题,android,flutter,flutter-dependencies,Android,Flutter,Flutter Dependencies,我正在创建一个应用程序,我需要启动Whatsapp。我尝试了这里描述的内容:并在我的项目上粘贴了相同的代码。问题是: What went wrong: The Android Gradle plugin supports only Kotlin Gradle plugin version 1.2.51 and higher. Project 'flutter_launch' is using version 1.1.51. Try: Run with --stacktrace option to

我正在创建一个应用程序,我需要启动Whatsapp。我尝试了这里描述的内容:并在我的项目上粘贴了相同的代码。问题是:

What went wrong:
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.2.51 and higher. Project 'flutter_launch' is using version 1.1.51.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
这是我的代码:

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: "3381559137", 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();
            },
          )
        ),
      ),
    );
  }
}
导入“包装:颤振/材料.省道”;
进口“包装:颤振发射/颤振发射.dart”;
void main()=>runApp(新的MyApp());
类MyApp扩展了StatefulWidget{
@凌驾
_MyAppState createState()=>new_MyAppState();
}
类MyAppState扩展了状态{
@凌驾
initState(){
super.initState();
}
void whatsAppOpen()异步{
等待发布。启动WathApp(电话:“3381559137”,信息:“你好”);
}
@凌驾
小部件构建(构建上下文){
返回新材料PP(
家:新脚手架(
appBar:新的appBar(
标题:新文本(“插件示例应用程序”),
),
正文:新中心(
孩子:扁平按钮(
子项:文本(“打开WhatsApp”),
已按下:(){
whatsAppOpen();
},
)
),
),
);
}
}
Android Gradle插件仅支持Kotlin Gradle插件版本1.2.51及更高版本。“颤振发射”项目使用的是1.1.51版

如果您遵循此操作,则通过更改此选项可以解决问题:

buildscript {
    ext.kotlin_version = '1.1.51'
    repositories {
        google()
为此:

buildscript {
    ext.kotlin_version = '1.2.51'
    repositories {
        google()
build.gradle
文件中

编辑 正如你可以检查这有一个问题,他们必须重建插件。 一个人提议用旧版本

var whatsappUrl ="whatsapp://send?phone=${_numberController.text}&text=${_textController.text}";
    await canLaunch(whatsappUrl)? launch(whatsappUrl):print("open whatsapp app link or do a snackbar with notification that there is no whatsapp installed");
使用此
url\u启动器
而不是
flatter\u启动器

url_launcher: 4.0.0 in pubspec.yml

import 'package:url_launcher/url_launcher.dart';

试一试,否则你可以看看如何从库中排除该版本并使用你的版本,就像这个家伙做的,但我没有测试过它

依赖项:

颤振:

sdk: flutter

url\u启动器:^5.1.0

你能把代码上传到某个地方吗?或者从你复制它的地方链接我,或者你将它复制到你的项目中所做的步骤?没有改变。。同样的错误!我认为问题在于“颤振发射”方案。。有可能吗?@IsaccoBosio我已经编辑了这个问题,是的,有可能,只要试试我的答案,如果它不起作用。。。你只需要等到他们用新版本重建项目…非常感谢你链接我的线程!终于成功了!