flutter-ml / google_ml_kit_flutter

A flutter plugin that implements Google's standalone ML Kit
MIT License
952 stars 727 forks source link

google_mlkit_smart_reply namespace in AndroidManifest.xml is no longer supported #577

Closed QPAYRE closed 5 months ago

QPAYRE commented 8 months ago

When I upgrade the Gradle version to 8.2.1 (latest) and set the targetSdkVersion version and compileSdkVersion to 34 using Flutter 3.16.7 and Dart 3.2.4, I have a namespace error on google_mlkit_smart_reply package :

Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
Incorrect package="com.google_mlkit_smart_reply" found in source AndroidManifest.xml: /Users/quentinpayre/Documents/google_ml_kit_flutter/packages/google_mlkit_smart_reply/android/src/main/AndroidManifest.xml.
Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
Recommendation: remove package="com.google_mlkit_smart_reply" from the source AndroidManifest.xml: /Users/quentinpayre/Documents/google_ml_kit_flutter/packages/google_mlkit_smart_reply/android/src/main/AndroidManifest.xml.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':google_mlkit_smart_reply:processDebugManifest'.
> A failure occurred while executing com.android.build.gradle.tasks.ProcessLibraryManifest$ProcessLibWorkAction
   > Incorrect package="com.google_mlkit_smart_reply" found in source AndroidManifest.xml: /Users/quentinpayre/Documents/google_ml_kit_flutter/packages/google_mlkit_smart_reply/android/src/main/AndroidManifest.xml.
     Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported.
     Recommendation: remove package="com.google_mlkit_smart_reply" from the source AndroidManifest.xml: /Users/quentinpayre/Documents/google_ml_kit_flutter/packages/google_mlkit_smart_reply/android/src/main/AndroidManifest.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 41s
Running Gradle task 'assembleDebug'...                             41.8s
Exception: Gradle task assembleDebug failed with exit code 1

I reproduced the bug on your exemple too. Steps to reproduce the behavior:

  1. google_ml_kit_flutter/packages/example/android/app/build.gradle set compileSdkVersion and targetSdkVersion to 34
  2. You will also need to add this namespace 'com.google_mlkit_example' in android section in build.gradle
  3. google_ml_kit_flutter/packages/example/android/build.gradle set classpath 'com.android.tools.build:gradle:8.2.1' in dependencies
  4. google_ml_kit_flutter/packages/example/android/gradle/wrapper/gradle-wrapper.properties set distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip
  5. See error

If I open my pub_cache and edit the google_mlkit_smart_reply/android/src/main/AndroidManifest.xml file removing the namespace package="com.google_mlkit_smart_reply" it runs well locally. Since I'm using Bitrise to Build my iOs and Android apps I have this issue on every android build.

In my project I use this version of google mlkit :

google_ml_kit: ^0.16.3

I tried to downgrade it but it didn't fix it

image

I don't know if I missed something but if someone found a solution please share it 🙂

Toph92 commented 7 months ago

Salut Quentin,

Same issue on Flutter Linux with gradle 8.2.2 and google_ml_kit: ^0.16.3: cdesbois@X300:~/Documents/flutter_app/flutter_application_1$ flutter build apk

Incorrect package="com.google_mlkit_smart_reply" found in source AndroidManifest.xml: /home/cdesbois/.pub-cache/hosted/pub.dev/google_mlkit_smart_reply-0.9.0/android/src/main/AndroidManifest.xml. Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported. Recommendation: remove package="com.google_mlkit_smart_reply" from the source AndroidManifest.xml: /home/cdesbois/.pub-cache/hosted/pub.dev/google_mlkit_smart_reply-0.9.0/android/src/main/AndroidManifest.xml.

FAILURE: Build failed with an exception.

BUILD FAILED in 2s Running Gradle task 'assembleRelease'... 2 433ms Gradle task assembleRelease failed with exit code 1

My current workaround is to use gradle 7.3.0

image