Closed RafaelBarbosatec closed 2 years ago
Hi @RafaelBarbosatec
This could just be a corrupted file or bad sector. Could you try clearing your pub cache or just deleting the firebase-performance
folder in the path in the error, and then running flutter pub get
and trying to build the aar again?
Thank you
I deleted the folder from the cache as you mentioned and you get the same error. π
I deleted the entire folder from the cache. I also ran flutter pub cache repair
. It still displays the same error message.
Running flutter build ios-framework
, normally generates the artifact.
@RafaelBarbosatec Could you please provide your flutter build -v
logs?
This seems to point to a mistake in the build.gradle
file. Can you check if there is anything missing or any typos?
I checked the build.gradle
of the project and everything appears ok.
I even did another test. I created a new flutter_module and added only the dependencies:
firebase_performance: 0.4.1
firebase_core: 0.5.1
or only
firebase_performance: 0.4.1
And by running the command flutter build aar
displays the same error.
I have experienced the same problems as @RafaelBarbosatec, but using
firebase_auth: ^0.18.2
and separately with
cloud_firestore: ^0.14.2
I can reproduce the problem by creating a new module with
flutter create -t module --org com.example aar_example
and then running
flutter build aar
which failed with
Execution failed for task ':firebase_auth:uploadArchives'. Could not publish configuration 'archives' Could not write to file '/home/mark.melling/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.18.2/android/build/poms/pom-default.xml'.
@markusaksli-nc Any other ideas of what it might be? Apparently it is not something isolated to firebase-performance.
Reproducible on the latest master 1.24.0-8.0.pre.149
.
Was able to reproduce this with most of the latest firebase plugins except from just firebase_core: ^0.5.2
on its own. Steps as described above (create default module, add dependency, build aar).
@RafaelBarbosatec I'm not sure what this could be since it is widespread. One of the members might have insight.
Is there any known workaround to this problem?
I had this problem two months agoοΌ hope for a quick resolution
Any solution for that problem?
Hi guys, has anyone solved this problem?
This probelm is becoming increasingly problematic. My solution to date is to stay on an old version of the firebase plugins, but I can't do do this forever. Given that basically you can't build an aar with the latest version of the firebase plugins I'm surprised there aren't more people like me that are affected by this issue. Or may be there is a work around that I just don't know about. Any help or suggestions much appreciated.
"Solved" with a workaround. Import the android directory as android project with Android studio. From there you can generate your aar (eg. by executing an assembleRelease/Debug). Hope it helps
Thanks @danimazzocchi, that was useful, taking the approach that I think you were suggesting I wasn't able to generated the POM file as well as the aar. I decided to dig a bit deeper into what was causing the issue.
It turns out that the actual error is
Gradle fails to create POM with βThe configuration to scope mapping is not unique.β
Which occurs in:
packages/flutter_tools/gradle/aar_init_script.gradle
Generally I'm happy not to know too much about gradle, as long as it works, life's too short! but it would have actually been useful in this case.
Anyway I hacked the script just so that scope mappings were different, this did result in me being able to build the aar along with the POM and this has now been successfully included in the app.
@markmelling how did you hack the script...?? enlighten us... I am also looking for a solution.
@Harshdeep4295 Bear in mind that I don't know what I'm doing, at least with gradle, all I did was make the priority different. So, in packages/flutter_tools/gradle/aar_init_script.gradle, at the bottom of the function below rather than each mapping having the same priority (300) I added 100 for each. I hope that helps
` void overrideDefaultPublishConfig(Project project, variant) { String variantName = variant.name.capitalize() Task bundle = project.tasks.findByName("bundle${variantName}Aar") // gradle:3.2.0 if (bundle == null) { bundle = project.tasks.findByName("bundle${variantName}") // gradle:3.1.0 } if (bundle == null) { throw new GradleException("Can't generate AAR for variant ${variantName}."); } // Clear the current archive artifacts since the artifacts are based on android.defaultPublishConfig. project.configurations["archives"].artifacts.clear() // Add the artifact that will be published. project.artifacts.add("archives", bundle)
def scopeMappings = project.uploadArchives.repositories.mavenDeployer.pom.scopeMappings
// Clear the scope mappings added by AGP since they are based on the current android.defaultPublishConfig.
scopeMappings.mappings.clear()
// Add the new mappings.
int priority = 300
for (Configuration configuration : flattenConfiguration(variant.runtimeConfiguration)) {
//scopeMappings.addMapping(/* priority = */ 300, configuration, "compile")
scopeMappings.addMapping(/* priority = */ priority, configuration, "compile")
priority = priority + 100
}
} `
Hi @markmelling, It is working, but it hacks right, so we need to fix this root cause. Hope to get something on this. Also, can you give reference to how Gradle actually works so that I can dig a bit about fixing this one?
Hi @Harshdeep4295, I'm glad it worked, but as you say it is a true hack. Sorry, I really can't help on the gradle front, I've already wasted too much of my life delving into technologies that I rarely use.
I have the same issue with these plugins installed:
firebase:
dependency: transitive
description:
name: firebase
url: "https://pub.dartlang.org"
source: hosted
version: "9.0.1"
firebase_analytics:
dependency: transitive
description:
name: firebase_analytics
url: "https://pub.dartlang.org"
source: hosted
version: "8.0.2"
firebase_analytics_platform_interface:
dependency: transitive
description:
name: firebase_analytics_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
firebase_analytics_web:
dependency: transitive
description:
name: firebase_analytics_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
This is the error i got:
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':firebase_analytics:uploadArchives'.
> Could not publish configuration 'archives'
> Could not write to file
'/Users/daanporon/.pub-cache/hosted/pub.dartlang.org/firebase_analytics-8.0.2/android/build/poms/pom-default.xml'.
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':firebase_messaging:uploadArchives'.
> Could not publish configuration 'archives'
> Could not write to file
'/Users/daanporon/.pub-cache/hosted/pub.dartlang.org/firebase_messaging-9.1.3/android/build/poms/pom-default.xml'.
* 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 12s
I tried the fix from @danimazzocchi without any luck, afterwards i tried the hack from @markmelling and this one did work ...
@markmelling - Thank you! This hack worked for me as well. Anyone know if this will be addressed in the next release?
Hey @markmelling, Is this hack still necessary with the latest plugins/stable version of gradle?
Hey @RafaelBarbosatec. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
Since there haven't been any recent updates here, I am going to close this issue.
@RafaelBarbosatec if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.
I can still see the issue. Build is getting failed with below error . Flutter doc: `Doctor summary (to see all details, run flutter doctor -v): [β] Flutter (Channel stable, 2.10.1, on Microsoft Windows [Version 10.0.19043.1526], locale en-US) [β] Android toolchain - develop for Android devices (Android SDK version 30.0.3) [β] Chrome - develop for the web [β] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.3) [β] Android Studio (version 2020.3) [β] VS Code (version 1.64.2) [β] Connected device (4 available) [β] HTTP Host Availability
β’ No issues found!`
Dependency used: `dependencies: flutter: sdk: flutter shared_preferences: ^2.0.8 objectbox: ^1.2.0 objectbox_flutter_libs: ^1.2.0 path_provider: ^2.0.5 mqtt_client: ^9.6.1 provider: ^6.0.1 logger: ^1.1.0
retrofit: ^2.2.0 built_value: ^8.1.2 dio: ^4.0.1 injectable: ^1.5.0 get_it: ^7.2.0 json_annotation: ^4.3.0 firebase_messaging: ^10.0.9 firebase_analytics: ^8.3.4 firebase_core: ^1.8.0 f_logs: ^2.0.0 connectivity: ^3.0.6 mime_type: ^1.0.0 file: ^6.1.2 http: ^0.13.4 http_interceptor: ^1.0.1 flutter_video_info: ^1.2.0 audioplayers: ^0.20.1 crypto: ^3.0.1`
only workaround solution which worked for me - script file provided by @markmelling . Don't we have any proper solution ?
@chandragupt1201 were you able to successfully integrate firebase_analytics?
Bug report
Does not generate aar in version 0.4.0+2 In version 0.3.2 it was able to generate the aar artifact. with this new version I get an error that I don't know how to solve.
Steps to reproduce
Steps to reproduce the behavior:
flutter build aar
Flutter doctor
Run
flutter doctor
and paste the output below:Click To Expand
``` Doctor summary (to see all details, run flutter doctor -v): [β] Flutter (Channel stable, 1.22.2, on Mac OS X 10.15.6 19G73, locale pt-BR) [!] Android toolchain - develop for Android devices (Android SDK version 30.0.2) ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses [β] Xcode - develop for iOS and macOS (Xcode 12.0.1) [!] Android Studio (version 4.1) β Flutter plugin not installed; this adds Flutter specific functionality. β Dart plugin not installed; this adds Dart specific functionality. [β] VS Code (version 1.50.1) [β] Connected device (2 available) ! Doctor found issues in 2 categories. ```Flutter dependencies
Run
flutter pub deps -- --style=compact
and paste the output below:Click To Expand
``` Dart SDK 2.10.2 Flutter SDK 1.22.2 app 1.0.0+1 dependencies: - carousel_slider 2.3.1 [flutter] - collection 1.15.0-nullsafety.3 - firebase_core 0.5.0+1 [firebase_core_platform_interface flutter quiver meta firebase_core_web] - firebase_performance 0.4.0+2 [flutter firebase_core] - flip_card 0.4.4 [flutter] - flutter 0.0.0 [characters collection meta typed_data vector_math sky_engine] - flutter_plugin_android_lifecycle 1.0.11 [flutter] - flutter_svg 0.19.1 [flutter meta path_drawing vector_math xml] - geolocator 6.1.0 [flutter geolocator_platform_interface] - get_it 5.0.1 [async meta] - google_maps_flutter 1.0.4 [flutter flutter_plugin_android_lifecycle google_maps_flutter_platform_interface] - http 0.12.2 [http_parser path pedantic] - intl 0.16.1 [path] - permission_handler 5.0.1+1 [flutter meta permission_handler_platform_interface] - rxdart 0.18.1 - shimmer 1.1.2 [flutter] - sliding_up_panel 1.0.2 [flutter] - stack_trace 1.10.0-nullsafety.1 [path] - url_launcher 5.4.7 [flutter url_launcher_platform_interface url_launcher_web url_launcher_macos] dev dependencies: - flutter_test 0.0.0 [flutter test_api path fake_async clock stack_trace vector_math async boolean_selector characters charcode collection matcher meta source_span stream_channel string_scanner term_glyph typed_data] - mockito 4.1.2 [analyzer build code_builder collection dart_style matcher meta source_gen test_api] - pedantic 1.9.2 [meta] transitive dependencies: - _fe_analyzer_shared 7.0.0 [meta] - analyzer 0.39.17 [_fe_analyzer_shared args charcode cli_util collection convert crypto glob html meta package_config path pub_semver source_span watcher yaml] - args 1.6.0 - async 2.5.0-nullsafety.1 [collection] - boolean_selector 2.1.0-nullsafety.1 [source_span string_scanner] - build 1.5.0 [analyzer async convert crypto logging meta path glob] - built_collection 4.3.2 [collection quiver] - built_value 7.1.0 [built_collection collection fixnum quiver] - characters 1.1.0-nullsafety.3 - charcode 1.2.0-nullsafety.1 - cli_util 0.2.0 [path] - clock 1.1.0-nullsafety.1 - code_builder 3.5.0 [built_collection built_value collection matcher meta] - convert 2.1.1 [charcode typed_data] - crypto 2.1.5 [collection convert typed_data] - csslib 0.16.2 [source_span] - dart_style 1.3.6 [analyzer args path source_span] - fake_async 1.2.0-nullsafety.1 [clock collection] - firebase 7.3.2 [http http_parser js] - firebase_core_platform_interface 2.0.0 [flutter meta plugin_platform_interface quiver] - firebase_core_web 0.2.0 [firebase firebase_core_platform_interface flutter flutter_web_plugins meta js] - fixnum 0.10.11 - flutter_web_plugins 0.0.0 [flutter characters collection meta typed_data vector_math] - geolocator_platform_interface 1.0.5 [flutter meta plugin_platform_interface vector_math] - glob 1.2.0 [async collection node_io path pedantic string_scanner] - google_maps_flutter_platform_interface 1.0.4 [flutter meta plugin_platform_interface stream_transform] - html 0.14.0+4 [csslib source_span] - http_parser 3.1.4 [charcode collection source_span string_scanner typed_data] - js 0.6.1+1 - logging 0.11.4 - matcher 0.12.10-nullsafety.1 [stack_trace] - meta 1.3.0-nullsafety.3 - node_interop 1.1.1 [js] - node_io 1.1.1 [node_interop path] - package_config 1.9.3 [path charcode] - path 1.8.0-nullsafety.1 - path_drawing 0.4.1+1 [vector_math meta path_parsing flutter] - path_parsing 0.1.4 [vector_math meta] - permission_handler_platform_interface 2.0.1 [flutter meta plugin_platform_interface] - petitparser 3.1.0 [meta] - plugin_platform_interface 1.0.2 [meta] - pub_semver 1.4.4 [collection] - quiver 2.1.3 [matcher meta] - sky_engine 0.0.99 - source_gen 0.9.7+1 [analyzer async build dart_style glob meta path pedantic source_span] - source_span 1.8.0-nullsafety.2 [charcode collection path term_glyph] - stream_channel 2.1.0-nullsafety.1 [async] - stream_transform 1.2.0 - string_scanner 1.1.0-nullsafety.1 [charcode source_span] - term_glyph 1.2.0-nullsafety.1 - test_api 0.2.19-nullsafety.2 [async boolean_selector collection meta path source_span stack_trace stream_channel string_scanner term_glyph matcher] - typed_data 1.3.0-nullsafety.3 [collection] - url_launcher_macos 0.0.1+5 [flutter] - url_launcher_platform_interface 1.0.7 [flutter meta plugin_platform_interface] - url_launcher_web 0.1.1+5 [url_launcher_platform_interface flutter flutter_web_plugins meta js] - vector_math 2.1.0-nullsafety.3 - watcher 0.9.7+15 [async path pedantic] - xml 4.5.1 [collection convert meta petitparser] - yaml 2.2.1 [charcode collection string_scanner source_span] ```