Skip to content

🛑 flutter config --explicit-package-dependencies-: Gradle release build fails with only dev-dependencies #161780

@matanlurey

Description

@matanlurey

In #160289, I attempt to enable flutter config --explicit-package-dependencies.

It's getting there... the next blocker after updating the lock files is this:

$ cd dev/integration_tests/spell_check
$ flutter config --explicit-package-dependencies
$ flutter build apk

e: file:///Users/matanl/Developer/flutter/dev/integration_tests/spell_check/android/app/src/main/kotlin/com/example/sc_int_test/MainActivity.kt:3:8 Unresolved reference: io
e: file:///Users/matanl/Developer/flutter/dev/integration_tests/spell_check/android/app/src/main/kotlin/com/example/sc_int_test/MainActivity.kt:5:22 Unresolved reference: FlutterActivity

FAILURE: Build failed with an exception.

From what I can tell, it's due to this stanza in flutter.groovy:

if (!isFlutterAppProject() || getPluginList(project).size() == 0) {
addApiDependencies(project, buildType.name,
"io.flutter:flutter_embedding_$flutterBuildMode:$engineVersion")
}

With our new logic flow (TM), it's possible for plugins to evaluate to size() > 0 and no plugins to receive the Flutter embedding dependencies. From talking to @gmackall this may or may not be intentional, we can figure that out debugging and submitting PRs fixing these tests.

What I'd like to see is:

  1. android_release_builds_exclude_dev_dependencies_test showcases the failure being talked about (and is fixed)
  2. The above workflow (cd dev/integration_tests/spell_check && flutter build apk) works when the flag is enabled

// Add devDependencyPlugin as dependency of flutterProject.
await flutterProject.addPlugin(
'dev_dependency_plugin',
options: <String>['--path', path.join(tempDir.path, 'dev_dependency_plugin')],
);

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listf: integration_testThe flutter/packages/integration_test pluginfyi-toolFor the attention of Flutter Tool teamplatform-androidAndroid applications specificallyteam-androidOwned by Android platform team

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions