intl_phone_number_input icon indicating copy to clipboard operation
intl_phone_number_input copied to clipboard

update the libphonenumber_plugin to the v2 Android Plugin

Open gerfalcon opened this issue 3 years ago • 3 comments

Describe the bug I tried to add the package into a Flutter project which is integrated into an existing Android app as a module. As a result, it caused a runtime crash:

 E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.x, PID: 7577
    java.lang.NullPointerException: Attempt to invoke interface method 'void io.flutter.plugin.common.BinaryMessenger.setMessageHandler(java.lang.String, io.flutter.plugin.common.BinaryMessenger$BinaryMessageHandler)' on a null object reference
        at io.flutter.plugin.common.MethodChannel.setMethodCallHandler(MethodChannel.java:119)
        at com.codeheadlabs.libphonenumber.LibphonenumberPlugin.registerWith(LibphonenumberPlugin.java:29)
        at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(Unknown Source:35)
        at x.FlutterFragmentActivity.provideFlutterEngine(FlutterFragmentActivity.kt:33)

According to this warning the libphonenumber plugin (which is a dependency of the current package) can be updated to the v2 Android Plugin APIs by following https://flutter.dev/go/android-plugin-migration.

Package version ^0.7.0+2

Flutter version 2.2.1

** Targeted platforms (please complete the following information):**

  • Android

Additional context I heavily like your package. It is well designed and super customizable, that is why I created this request.

gerfalcon avatar Jul 29 '21 12:07 gerfalcon

Just to reinforce this topic, as I upgraded my Flutter version to Channel beta, 2.5.0-5.1.pre, on Microsoft Windows [Version 10.0.19041.1165], locale en-US today it started showing the following notification while compiling the project:

The plugin `libphonenumber` use a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if these plugins support the Android V2 embedding. Otherwise, consider removing them since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.

fbanyai avatar Aug 12 '21 14:08 fbanyai

As Flutter 2.5 reached stable, I get this on every build now:

The plugin `libphonenumber` uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.

amitkot avatar Sep 09 '21 09:09 amitkot

I'm having the same issue The plugin libphonenumber uses a deprecated version of the Android embedding. To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs. If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.

fodedoumbouya avatar Oct 09 '21 02:10 fodedoumbouya