Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[firebase_analytics]: Firebase Analytics 10.10.5 and 10.10.4 version cannot build Android #12770

Closed
1 task done
DevHHM opened this issue May 11, 2024 · 7 comments
Closed
1 task done
Assignees
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. platform: android Issues / PRs which are specifically for Android. plugin: analytics resolution: solution-provided A solution has been provided in the issue. type: bug Something isn't working

Comments

@DevHHM
Copy link

DevHHM commented May 11, 2024

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Analytics

Which platforms are affected?

Android

Description

hello, i need help.
I'm applying firebase analystic for the first time and I'm getting errors when I build android on flutter.
IOS builds fine, but only Android has the problem.
I didn't do anything extra, I just looked at the documentation for firebase_analystics and followed it.

Reproducing the issue

firebase_analytics add
flutter pub remove firebase_analytics

pubspec.yaml (skip app id)

version: 1.0.9+15

environment:
  sdk: '>=3.1.5 <4.0.0'

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
  flutter:
    sdk: flutter


  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2
  bloc: ^8.1.2
  flutter_bloc: ^8.1.3
  go_router: ^14.1.0
  flutter_svg: ^2.0.9
  equatable: ^2.0.5
  hydrated_bloc: ^9.1.2
  path_provider: ^2.1.1
  fluttertoast: ^8.2.4
  kakao_flutter_sdk: ^1.7.0
  flutter_launcher_icons: ^0.13.1
  permission_handler: ^11.0.1
  http: ^1.1.0
  json_serializable: ^6.7.1
  json_annotation: ^4.8.1
  badges: ^3.1.2
  intl: ^0.19.0
  korea_regexp: ^1.2.1
  flutter_secure_storage: ^4.2.1
  flutter_naver_login: ^1.8.0
  sign_in_with_apple: ^6.1.0
  logger: ^2.2.0
  firebase_core: ^2.31.0
  firebase_messaging: ^14.9.2
  flutter_local_notifications: ^17.1.2
  app_links: ^6.0.1
  firebase_analytics: ^10.10.4

dev_dependencies:
  build_runner: ^2.4.7
  flutter_test:
    sdk: flutter

flutter_launcher_icons:
  android: "launcher_icon"
  ios: true
  image_path: "assets/icons/app_icon.png"
  min_sdk_android: 21 # android min sdk min:16, default 21
  web:
    generate: true
    image_path: "assets/icons/app_icon.png"
#    background_color: "#hexcode"
#    theme_color: "#hexcode"
  windows:
    generate: true
    image_path: "assets/icons/app_icon.png"
    icon_size: 48 # min:48, max:256, default: 48
  macos:
    generate: true
    image_path: "assets/icons/app_icon.png"

  # The "flutter_lints" package below contains a set of recommended lints to
  # encourage good coding practices. The lint set provided by the package is
  # activated in the `analysis_options.yaml` file located at the root of your
  # package. See that file for information about deactivating specific lint
  # rules and activating additional ones.
  flutter_lints: ^2.0.0

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter packages.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
     - assets/images/
     - assets/icons/
     - assets/svg/

Firebase Core version

2.31.0

Flutter Version

3.19.6

Relevant Log Output

/Users/username/Developments/flutter/bin/flutter --no-color build apk

Running Gradle task 'assembleRelease'...                        
Note: /Users/username/.pub-cache/hosted/pub.dev/flutter_secure_storage-4.2.1/android/src/main/java/com/it_nomads/fluttersecurestorage/FlutterSecureStoragePlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Font asset "CupertinoIcons.ttf" was tree-shaken, reducing it from 257628 to 848 bytes (99.7% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
Font asset "MaterialIcons-Regular.otf" was tree-shaken, reducing it from 1645184 to 2260 bytes (99.9% reduction). Tree-shaking can be disabled by providing the --no-tree-shake-icons flag when building your app.
ERROR:D8: com.android.tools.r8.kotlin.H

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeExtDexRelease'.
> Could not resolve all files for configuration ':app:releaseRuntimeClasspath'.
   > Failed to transform play-services-measurement-api-21.6.1.aar (com.google.android.gms:play-services-measurement-api:21.6.1) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=false, dexing-min-sdk=21, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingWithClasspathTransform: /Users/username/.gradle/caches/transforms-3/88a075a3126a401f5a1265280fdb064b/transformed/jetified-play-services-measurement-api-21.6.1-runtime.jar.
         > Error while dexing.

* 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 36s
Running Gradle task 'assembleRelease'...                           36.9s

┌─ Flutter Fix ──────────────────────────────────────────────────────────────┐
│ [!] The shrinker may have failed to optimize the Java bytecode.            │
│ To disable the shrinker, pass the `--no-shrink` flag to this command.      │
│ To learn more, see: https://developer.android.com/studio/build/shrink-code │
└────────────────────────────────────────────────────────────────────────────┘
Gradle task assembleRelease failed with exit code 1
Process finished with exit code 1

Flutter dependencies

Expand Flutter dependencies snippet
Replace this line with the contents of your `flutter pub deps -- --style=compact`.

Additional context and comments

I've also reached out to the firebase slack for help.
However, I did a little research on past cases like this and found that
'This is a library bug', so I'm leaving it as an issue.

@DevHHM DevHHM added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels May 11, 2024
@DevHHM DevHHM changed the title [firebase_analytics]: Failed to transform play-services-measurement-api-21.6.1.aar (com.google.android.gms:play-services-measurement-api:21.6.1) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=21, org.gradle.status=release, org.gradle.usage=java-runtime} [firebase_analytics]: Firebase Analytics 10.10.5 version cannot build Android May 11, 2024
@DevHHM DevHHM changed the title [firebase_analytics]: Firebase Analytics 10.10.5 version cannot build Android [firebase_analytics]: Firebase Analytics 10.10.5 and 10.10.4 version cannot build Android May 11, 2024
@TarekkMA TarekkMA added plugin: analytics platform: android Issues / PRs which are specifically for Android. labels May 13, 2024
@TarekkMA
Copy link
Contributor

Hey @DevHHM, thank you for reporting this issue. I've tested version 10.10.5 of analytics, and it runs without issues. Could you please try to provide a minimal but complete reproducible example where this issue occurs?

@TarekkMA TarekkMA added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels May 13, 2024
@TarekkMA TarekkMA self-assigned this May 13, 2024
@AkashBonito
Copy link

Same Issue occuring to me, even in firebase_analytics: 10.10.3 version.

@DevHHM
Copy link
Author

DevHHM commented May 14, 2024

@TarekkMA Unfortunately, we don't have any examples to provide.

Because all I did was add Firebase_analytics, read the official documentation, set up the file, and initialized it on app launch.

For now, the problem is solved. On Stackoverflow, users with similar symptoms to mine said that raising Minsdkversion to 24 should fix it, so I followed that.
I did so, and it built without issue.

However, the official documentation says to keep it at 21. Can you please confirm that this is indeed the case?

@AkashBonito If that doesn't work, try raising minsdkversion to 24 like I did.

@google-oss-bot google-oss-bot added Needs Attention This issue needs maintainer attention. and removed blocked: customer-response Waiting for customer response, e.g. more information was requested. labels May 14, 2024
@AkashBonito
Copy link

@TarekkMA Worked for me after changing minsdkversion to 24.
Thanks a ton!!

@TarekkMA
Copy link
Contributor

@DevHHM, glad to hear that you have found a fix for this issue. Can you please send a link to the documentation that mentions minSdk 21 so we can update it?

@TarekkMA TarekkMA added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels May 14, 2024
@russellwheatley
Copy link
Member

@TarekkMA - I just built (debug + release) the analytics example app with minSdk 21, and it worked. This issue can be closed out as the user has a solution 👌

@TarekkMA TarekkMA added the resolution: solution-provided A solution has been provided in the issue. label May 15, 2024
@DevHHM
Copy link
Author

DevHHM commented May 15, 2024

@TarekkMA https://firebase.google.com/support/release-notes/android If you look here, it says that MINSDKVERSION must be 21 or higher. Of course, this is the release notes for Android, but the article says that you should use version 21 or higher.
And the flutter documentation doesn't specify it at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. platform: android Issues / PRs which are specifically for Android. plugin: analytics resolution: solution-provided A solution has been provided in the issue. type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants