Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The plugin pdf_flutter uses a deprecated version of the Android embedding. #41

Open
MobileMon opened this issue Nov 8, 2021 · 5 comments

Comments

@MobileMon
Copy link

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.

@kmorpex
Copy link

kmorpex commented Nov 10, 2021

i have this problem too

@emmaweberyd
Copy link

Hi @erluxman! 👋 I’m working on a project that relies on your plugin. I get this deprecation warning too, and from looking into it and reading the migration guide posted above, it looks like it might be low hanging fruit 🍌🍎🍍.



I cloned your repo, and did two things to get rid of the warnings:







1. Removed the line 
android:name="io.flutter.app.FutterApplication" within the application tags in the AndroidManifest.xml for the example. 











2. In the PdfFlutterPlugin.java I made sure that PdfFlutterPlugin implements FlutterPlugin. It came out looking like this:



package com.erluxman.pdf_flutter;

import io.flutter.plugin.common.PluginRegistry.Registrar;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import androidx.annotation.NonNull;

/** PdfFlutterPlugin */
public class PdfFlutterPlugin implements FlutterPlugin {
  /**
   * Legacy method for supporting apps that have not migrated to the v2 Android embedding
   */
  public static void registerWith(@NonNull Registrar registrar) {
    registrar
            .platformViewRegistry()
            .registerViewFactory(
                    "pdf_flutter_plugin", new PdfFlutterFactory(registrar.messenger()));
  }

  @Override
  public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) {
    binding
            .getPlatformViewRegistry()
            .registerViewFactory(
                    "pdf_flutter_plugin", new PdfFlutterFactory(binding.getBinaryMessenger()));
  }

  @Override
  public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {

  }
}

I'm not a contributor so I can't make a pull request but I thought I could at least open up a conversation about it. Where are we with this?

@akadatsky
Copy link
Contributor

@emmaweberyd thanks for the tip, I sent a merge request with these changes:
#46

@chiragnahata
Copy link

When will it get merged and the latest update arrives. Please inform me as soon as it happens. I am unable to build the app for it. So please so the needful as soon as possible.

@CARocha
Copy link

CARocha commented Apr 23, 2023

How to install version that have this PR that solve this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants