Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
One or more plugins required a higher Android SDK version.
solution- I upgraded the compileSdkVersion to 33
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
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
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.
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.
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?