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

Successfully migrated to V2 #7

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Joymakwana2003
Copy link

The Flutter application is created using an older version of the Android embedding. It is being deprecated in favor of Android embedding v2. There are two ways to resolve the issue-

1)To pass the --ignore-deprecation flag to ignore the check and continue with the deprecated v1 embedding. However,
the v1 Android embedding will be removed in future versions of Flutter. Therefore, it is better to migrate it.
2) Migration of the project to V2

So, I started working on migrating the project to V2.

During the process of migration I faced the following errors:

  1. One or more plugins required a higher Android SDK version.
    solution- I upgraded the compileSdkVersion to 33

  2. There were duplicate classes in two different Kotlin standard library modules being used in the application.
    solution- I updated the Kotlin version and other dependencies to the latest version and then removed multiple versions of the Kotlin standard library in app's build.gradle file

  3. It failed to apply plugin 'kotlin-android' because the Gradle version 6.7 was not compatible with the Kotlin Gradle plugin
    solution- Changed the DistributionUrl in gradle wrapper properties to gradle version 7.2

  4. There were many small errors like unresolved references, it could not resolve all files for configuration, it could not find io.flutter:flutter-embedding-android.

After applying all the fixes, I migrated it to V2, and it got built successfully.
image

As we can see from above, the application build is successful but there is a runtime exception and it occured because it was unable to instantiate application plugin flutter_nearby_connections.

So, to solve this error, I tried to call, the GeneratedPluginRegistrant.registerWith method with the FlutterEngine instance as a parameter. This method registers all the plugins that are listed in the pubspec.yaml file of the Flutter project. The pubspec.yaml file specifies the dependencies of the project, including any Flutter plugins that are needed.
Screenshot (98)

After applying this fix, it got build successfully and there was not any runtime exception thrown but at the time of opening the app it got closed abruptly.

In my opinion, we should build a new flutter project and add the existing source file there. I would like to work on it.

Shall I start working on it @thuva4?

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

Successfully merging this pull request may close these issues.

1 participant