facundomedica / fast_qr_reader_view

A Fast QR Reader widget for Flutter. For both Android and iOS
MIT License
294 stars 163 forks source link

AndroidX incompatibilities #44

Closed weiqilu closed 5 years ago

weiqilu commented 5 years ago

I started a new Flutter project and followed the guide here exactly but continue to receive the following error when running on Android.

How can I resolve this?

Launching lib/main.dart on Google Pixel 2 in debug mode...

registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

Note: /Users/computer/Library/flutter/.pub-cache/git/fast_qr_reader_view-05d629020b19b426c5d8f20a88d5a810ff304d7b/android/src/main/java/co/apperto/fastqrreaderview/common/CameraSource.java uses or overrides a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

D8: Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/2.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/3.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/6.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/7.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/8.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/9.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/10.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/11.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/12.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/13.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/15.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/16.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/17.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/18.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/19.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/20.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/21.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/22.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/23.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/24.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/25.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/26.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/27.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/28.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/29.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/30.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/31.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/32.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/33.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/34.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/35.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/37.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/38.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/39.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/40.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/41.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/42.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/43.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/44.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/45.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/46.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/47.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/48.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/49.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/50.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/51.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/52.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/53.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/54.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/55.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/56.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/57.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/58.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/59.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/60.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/61.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/62.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/63.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/64.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/65.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/66.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/67.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/68.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/69.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/70.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/71.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/72.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/73.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/74.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/75.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/76.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/77.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/78.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/79.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/80.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/81.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/82.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/83.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/84.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/85.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/86.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/87.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/88.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/89.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/90.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/91.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/92.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/93.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/94.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/95.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/96.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/97.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/98.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/99.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/100.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/101.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/103.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/104.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/105.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/106.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/107.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/108.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/109.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/110.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/111.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/112.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/113.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/114.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/115.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/116.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/117.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/118.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/119.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/122.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/123.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/125.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/126.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/127.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/128.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/129.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/130.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/131.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/132.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/133.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/134.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/135.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/136.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/137.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/138.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/139.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/140.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/141.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/142.jar, /Users/computer/Documents/Flutter Projects/scanqrtest/build/app/intermediates/transforms/dexBuilder/debug/143.jar
  Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
  Program type already present: android.support.v4.os.ResultReceiver$MyResultReceiver

* 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 1m 45s

*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See https://goo.gl/CP92wY for more information on the problem and how to fix it.
*******************************************************************************************

Gradle task assembleDebug failed with exit code 1

Exited (sigterm)
jmeinlschmidt commented 5 years ago
  1. Just to be sure flutter clean (sometimes helps)
  2. Add dependency as listed above (facundomedica's fork)
    fast_qr_reader_view: 
    git:
      url: git://github.com/facundomedica/fast_qr_reader_view.git
  3. Make sure your app is AndroidX compatible at https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility#not-recommended-manually-migrate-your-app
  4. android/build.gradle check
    classpath 'com.android.tools.build:gradle:3.3.0'
    classpath 'com.google.gms:google-services:4.2.0'
  5. in android/gradle.properties, append
    android.enableJetifier=true
    android.useAndroidX=true
  6. in android/app/build.gradle, under android {, make sure CompileSdkVersion and targetSdkVersion are at least 28

Mine works like a charm. I had been receiving same error as you, until I did the steps shown above... Hope it helps.

weiqilu commented 5 years ago

@jmeinlschmidt Thanks a lot for the detailed explanation! It works perfectly now! 👍

jmeinlschmidt commented 5 years ago

@weiqilu Glad to hear. Please close this issue if you don't have any further questions. 👏

weiqilu commented 5 years ago

Resolved!