VeryGoodOpenSource / very_good_templates

Collection of open-source templates created and maintained by Very Good Ventures.
70 stars 15 forks source link

chore: Update Very Good Flutter Plugin Example App Android build chain #123

Closed tomarra closed 3 months ago

tomarra commented 5 months ago

Description

Coming out of #108. A lot of updates need to be made to the Very Good Flutter Plugin Example App to ensure its up to date.

Requirements

alestiago commented 3 months ago

When trying to run as is, without updating we get the output shown below. Updating all of the above should resolve the majority of issues.

$ flutter run
Launching lib/main.dart on Mi A2 in debug mode...
Upgrading build.gradle
Conflict detected between Android Studio Java version and Gradle version, upgrading Gradle version
from 6.7 to 7.6.1.
Upgrading gradle-wrapper.properties
You are applying Flutter's app_plugin_loader Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply

You are applying Flutter's main Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply

Warning: Flutter support for your project's Android Gradle Plugin version (4.1.0) will soon be dropped. Please upgrade your Android Gradle Plugin version to a version of at least 7.0.0 soon.
Alternatively, use the flag "--android-skip-build-dependency-validation" to bypass this check.

Potential fix: Your project's AGP version is typically defined the plugins block of the `settings.gradle` file (/Users/alestiago/Developer/workspace/oss/very_good_templates/very_good_flutter_plugin/output2/test_plugin/test_plugin/example/android/settings.gradle), by a plugin with the id of com.android.application. 
If you don't see a plugins block, your project was likely created with an older template version. In this case it is most likely defined in the top-level build.gradle file (/Users/alestiago/Developer/workspace/oss/very_good_templates/very_good_flutter_plugin/output2/test_plugin/test_plugin/example/android/build.gradle) by the following line in the dependencies block of the buildscript: "classpath 'com.android.tools.build:gradle:<version>'".

Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/03 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/03 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/03 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Warning: unexpected element (uri:"", local:"extension-level"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>
Warning: unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>
Checking the license for package Android SDK Build-Tools 29.0.2 in /Users/alestiago/Library/Android/sdk/licenses
License for package Android SDK Build-Tools 29.0.2 accepted.
Preparing "Install Android SDK Build-Tools 29.0.2 (revision: 29.0.2)".
"Install Android SDK Build-Tools 29.0.2 (revision: 29.0.2)" ready.
Installing Android SDK Build-Tools 29.0.2 in /Users/alestiago/Library/Android/sdk/build-tools/29.0.2
"Install Android SDK Build-Tools 29.0.2 (revision: 29.0.2)" complete.
"Install Android SDK Build-Tools 29.0.2 (revision: 29.0.2)" finished.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module @2e876852

* 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

BUILD FAILED in 2m 36s
Running Gradle task 'assembleDebug'...                            158.0s
Error: Gradle task assembleDebug failed with exit code 
alestiago commented 3 months ago

With the latest updated on #150 and #151, creating the example and running now does work but still has one last warning to take care of:

$ flutter run
Launching lib/main.dart on Mi A2 in debug mode...
You are applying Flutter's main Gradle plugin imperatively using the apply script method, which is deprecated and will be removed in a future release. Migrate to applying Gradle plugins with the declarative plugins block: https://flutter.dev/go/flutter-gradle-plugin-apply

Running Gradle task 'assembleDebug'...                             21.1s
✓ Built build/app/outputs/flutter-apk/app-debug.apk
Syncing files to device Mi A2...                                    47ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

A Dart VM Service on Mi A2 is available at: http://127.0.0.1:49894/_THUULRYfgc=/
W/Gralloc3(24512): mapper 3.x is not supported
alestiago commented 3 months ago

The Java version is currently the same as when doing flutter create -t plugin --platforms android, hence keeping it as it is for now.

There are no further warnings when executing the example, and the PR description tasks have been now completed, hence closing as completed.