BlinkID / blinkid-flutter

ID scanning plugins for cross-platform apps built with Flutter.
80 stars 23 forks source link

Flutter v3.24.1 can not build on Android #70

Open omartinma opened 2 months ago

omartinma commented 2 months ago

Hi,

I'm currently using in my project the Flutter version 3.19.3. When upgrading to 3.24.1 I'm not able to build the Android project anymore, and I'm seeing this issue.

What is the maximum Flutter version supported by the library at the moment?

Thanks!

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
ERROR:/Users/myprofile/.gradle/caches/transforms-3/ce81779b4f1a3bd17c8fa4641cb4f760/transformed/jetified-appcompat-resources-1.7.0-runtime.jar: D8: java.lang.NullPointerException: Cannot invoke "String.length()" because "<parameter1>" is null
ERROR:/Users/myprofile/.gradle/caches/transforms-3/9749eb58411c3c662945afefe8b3d132/transformed/appcompat-1.7.0-runtime.jar: D8: java.lang.NullPointerException: Cannot invoke "String.length()" because "<parameter1>" is null

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeExtDexDebug'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Failed to transform appcompat-resources-1.7.0.aar (androidx.appcompat:appcompat-resources:1.7.0) 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.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for DexingWithClasspathTransform: /Users/myprofile/.gradle/caches/transforms-3/ce81779b4f1a3bd17c8fa4641cb4f760/transformed/jetified-appcompat-resources-1.7.0-runtime.jar.
         > Error while dexing.
   > Failed to transform appcompat-1.7.0.aar (androidx.appcompat:appcompat:1.7.0) 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}.
      > Execution failed for DexingWithClasspathTransform: /Users/myprofile/.gradle/caches/transforms-3/9749eb58411c3c662945afefe8b3d132/transformed/appcompat-1.7.0-runtime.jar.
         > Error while dexing.

It seems that blinkcard does not have the issue and it can run individually, but If i add both dependencies to the project the error message that I get is different:

   /Users/myprofile/.gradle/caches/transforms-3/2fd16129e9d0f64b53494b89029c54ce/transformed/jetified-blinkcard-2.9.3/res/values/values.xml:427:4: Duplicate value for resource 'attr/mb_onboardingImageColor' with config 'DEFAULT' and product ''. Resource was previously defined here: com.example.microblink_example.app-mergeDebugResources-31:/values/values.xml:3099: .
/Users/myprofile/.gradle/caches/transforms-3/fac84cd5ecf1ec88a8c98571217c9350/transformed/core-1.13.1/res/values/values.xml:176:4: Duplicate value for resource 'attr/mb_helpTooltipColor' with config 'DEFAULT' and product ''. Resource was previously defined here: com.example.microblink_example.app-mergeDebugResources-31:/values/values.xml:3205: .

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.ResourceCompilerRunnable
   > Resource compilation failed (Failed to compile values resource file /Users/myprofile/microblink_example/build/app/intermediates/incremental/debug/mergeDebugResources/merged.dir/values/values.xml. Cause: java.lang.IllegalStateException: Can not add resource (com.android.aaptcompiler.ParsedResource@3ff6c7fa) to table.,Can not add resource (com.android.aaptcompiler.ParsedResource@3bc954dc) to table.). Check logs for more details.
somyaguptagit commented 2 months ago

Hi @omartinma Thank you for reaching out! When you say you add both dependencies, do you mean BlinkID+BlinkCard(flutter)? could you also provide us additional logs of the exception? You can also reach out to us directly at support@microblink.com and we can assist you further.

omartinma commented 2 months ago

Hi @omartinma Thank you for reaching out! When you say you add both dependencies, do you mean BlinkID+BlinkCard(flutter)? could you also provide us additional logs of the exception? You can also reach out to us directly at support@microblink.com and we can assist you further.

Exactly @somyaguptagit, adding BlinkID and BlinkCard both using the latest version. Unfortunately, there are no more logs than what I provided. Not sure why the error message shown is different when adding both dependencies rather than only adding BlinkID.

I was able to replicate this in a clean project using flutter create and adding the dependency.

Let me know if you need more details.

Thanks!

radivojeostojic commented 2 months ago

@omartinma I had a similar issue yesterday, and I had to update the Android Gradle Plugin version to 8.1.3 to make it work.

mparadina commented 2 months ago

Hi @radivojeostojic and @omartinma

@radivojeostojic that is correct, updating to Gradle v8 should resolve the issue. Thank you for responding. I will update this information in the documentation in the upcoming release.

omartinma commented 2 months ago

Thanks both for your replies @radivojeostojic @mparadina.

Actually, I was using Gradle 8.7 with Android Gradle Plugin 8.5. I tried to use 8.1.3 and I'm still getting the same error when I combine the 2 libraries. If I use blinkid_flutter only I can run the project perfectly.

omartinma commented 2 months ago

Do we have any update about this topic? @somyaguptagit @mparadina Thanks!