• 10
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Problem launching Whatsapp from Flutter App

I am creating an app and I need to launch Whatsapp. I tryed what is described here: pub.dartlang.org/packages/flutter_launch and I pasted the same code on my project. Here is the problem:

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

This is my code:

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();
            },
          )
        ),
      ),
    );
  }
}
      • 1
    • Can you upload the code somewhere? Or link me from where you copied it, or the steps you did to copy this into your project?

The Android Gradle plugin supports only Kotlin Gradle plugin version 1.2.51 and higher. Project 'flutter_launch' is using version 1.1.51.

If you are following this example, the problem is solved changing this :

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

To this :

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

In build.gradle file

Edit

As you can check on this thread there's a problem and they have to rebuild the plugin. One guy proposed to work with the old version

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");

Using this url_launcher instead of flutter_launch

url_launcher: 4.0.0 in pubspec.yml

import 'package:url_launcher/url_launcher.dart';

Just give it a try, otherwise you can look to how to exclude the version from the library and use yours, like this guy did but I don't have tested it replace kotlin plugin from flutter on runtime

  • 1
Reply Report
      • 2
    • @IsaccoBosio I've editted the question, yes, it is possible, just try my answer, if it didn't work... you just have to wait until they rebuild the project with the new version...