问题从Flutter App发布Whatsapp

问题描述 投票:1回答:1

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

pub.dartlang.org/packages/flutter_launch

这是我的代码:

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
android flutter flutter-dependencies
1个回答
0
投票

Android Gradle插件仅支持Kotlin Gradle插件版本1.2.51及更高版本。项目'flutter_launch'正在使用1.1.51版。

如果您正在关注此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(); }, ) ), ), ); } } ,问题就解决了,改变了这个:

example

对此:

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

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

编辑

你可以查看这个build.gradle有一个问题,他们必须重建插件。一个人建议使用旧版本

thread

使用这个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_launcher

flutter_launch

试一试,否则你可以看看如何从库中排除版本并使用你的版本,就像这个人一样,但我没有测试过它url_launcher: 4.0.0 in pubspec.yml import 'package:url_launcher/url_launcher.dart';

© www.soinside.com 2019 - 2024. All rights reserved.