Closed mraleph closed 9 months ago
Hi Thanks for filing the issue, took me while to setup the engine locallly but finally I've pulled your PR locally into clone Gallery repository when running in debug mode, I am not seeing any such error
taha@pop-os:~/Documents/gallery$ fm run --local-engine-src-path /home/taha/Code/engine/src --local-engine=android_debug_unopt_arm64
Launching lib/main.dart on Redmi K20 Pro in debug mode...
Shrinking has been disabled for this build due to deferred components. Shrinking is not available for multi-apk applications.
This limitation is expected to be removed when Gradle plugin 4.2+ is available in Flutter.
Running Gradle task 'assembleDebug'... 21.7s
ā Built build/app/outputs/flutter-apk/app-debug.apk.
E/flutter (32246): [ERROR:flutter/shell/common/shell.cc(906)] Embedding reported invalid ViewportMetrics, ignoring update.
E/flutter (32246): physical_width: 0
E/flutter (32246): physical_height: 0
E/flutter (32246): device_pixel_ratio: 2.75
E/flutter (32246): [ERROR:flutter/shell/common/shell.cc(906)] Embedding reported invalid ViewportMetrics, ignoring update.
E/flutter (32246): physical_width: 0
E/flutter (32246): physical_height: 0
E/flutter (32246): device_pixel_ratio: 2.75
Syncing files to device Redmi K20 Pro... 1,136ms
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).
Running with unsound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety
An Observatory debugger and profiler on Redmi K20 Pro is available at: http://127.0.0.1:45019/IMn7aQ3JrxQ=/
The Flutter DevTools debugger and profiler on Redmi K20 Pro is available at:
http://127.0.0.1:9100?uri=http%3A%2F%2F127.0.0.1%3A45019%2FIMn7aQ3JrxQ%3D%2F
I couldn't run profile mode flutter_embedding_profile.pom wasn't found in the local engine out directory.
, Any ideas?
As a workaround, try adding this to the subprojects
section of Gallery's android/build.gradle
:
afterEvaluate {
if (plugins.hasPlugin('com.android.library')) {
dependencies {
implementation "io.flutter:flutter_embedding_profile:+"
}
}
}
I couldn't run profile mode
flutter_embedding_profile.pom wasn't found in the local engine out directory.
, Any ideas?
How did you build the profile engine? You need something like:
$ flutter/tools/gn --runtime-mode profile
$ ninja -C out/host_profile
$ flutter/tools/gn --runtime-mode profile --android --android-cpu arm64
$ ninja -C out/android_profile_arm64
As a workaround, try adding this to the
subprojects
section of Gallery'sandroid/build.gradle
:
Thanks @jason-simmons this indeed makes it build. Any idea why is this not part of the default template?
Hi @mraleph Thank you for the details!
I can confirm the issue
cc @blasten for thoughts on a better workflow for local engine builds. We have a workaround right now so it should not be a blocker.
https://github.com/flutter/flutter/blob/master/packages/flutter_tools/gradle/flutter.gradle#L371-L374 seems to be failing in this case.
@mraleph this is a bug in the Flutter plugin.
I am having the same issue, and can confirm this workaround https://github.com/flutter/gallery/issues/899#issuecomment-1427994205 solves my problem
Btw, in case anyone finds the error "Cannot run Project.afterEvaluate(Closure) when the project is already evaluated.", please put that code at the beginning of subprojects section, not the end.
In light of https://github.com/flutter/gallery/issues/1072, I'm going to close this in favor of https://github.com/flutter/flutter/issues/104667. Thanks everyone for helping each other debug and work around this!
(Note: assuming that https://github.com/flutter/gallery/pull/525 is landed. Otherwise you first need to apply that on top)
/cc @blasten