Skip to content

Native assets fail to build on Android with AGP 8.4 and multiple flavors #155038

@knopp

Description

@knopp

Error message:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDevDebugJniLibFolders'.
> [arm64-v8a/libnative_regex_pcre2.so] /Users/Matej/Projects/superlist1/packages/superlist/build/native_assets/android/jniLibs/lib/arm64-v8a/libnative_regex_pcre2.so	[arm64-v8a/libnative_regex_pcre2.so] /Users/Matej/Projects/superlist1/packages/superlist/build/native_assets/android/jniLibs/lib/arm64-v8a/libnative_regex_pcre2.so	[arm64-v8a/libnative_regex_pcre2.so] /Users/Matej/Projects/superlist1/packages/superlist/build/native_assets/android/jniLibs/lib/arm64-v8a/libnative_regex_pcre2.so: Error: Duplicate resources

In this case there are three flavors and the library is added three times. I tracked it down to flutter.groovy where the nativeAssetDir is added to project.android.sourceSets.main.jniLibs.srcDir per flavor, even though the directory does not depend on the flavor. Should be easy to fix.

cc @dcharkes

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: buildBuilding flutter applications with the toolplatform-androidAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versiont: gradle"flutter build" and "flutter run" on Androidteam-androidOwned by Android platform teamtoolAffects the "flutter" command-line tool. See also t: labels.triaged-androidTriaged by Android platform team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions