Тип программы уже присутствует: android.support.v4.os.ResultReceiver $ MyResultReceiver

У меня проблемы с вводом зависимости. Идея состоит в том, чтобы иметь возможность просматривать PDF-файл с URL-адреса. Как я видел в WEB, это делается путем добавления одной из зависимостей для PDF, я подробно описываю зависимости, которые я пытался использовать, и мне представляется та же ошибка:

  • flutter_full_pdf_viewer
  • pdf_viewer_plugin
  • flutter_plugin_pdf_viewer
  • flutter_pdfview

Каждый раз, когда я пытаюсь добавить любую из зависимостей, я получаю следующую ошибку:

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: 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\0.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\1.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\2.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\3.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\8.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\9.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\10.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\11.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\12.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\13.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\14.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\15.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\16.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\17.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\18.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\19.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\20.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\21.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\22.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\23.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\24.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\25.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\26.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\27.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\28.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\29.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\40.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\41.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\42.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\43.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\44.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\50.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\55.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\60.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\65.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\70.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\75.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\80.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\85.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\90.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\95.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\100.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\105.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\110.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\115.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\120.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\125.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\130.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\135.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\140.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\145.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\150.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\155.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\160.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\165.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\170.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\175.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\180.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\185.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\190.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\191.jar, 
C:\Users\Ladislao\AndroidStudioProjects\lukinapp\build\app\intermediates\transforms\dexBuilder\debug\192.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 2s
            *******************************************************************************************
            The Gradle failure may have been because of AndroidX 

incompatibilities in this Flutter app.
            *******************************************************************************************
            Finished with error: Gradle task assembleDebug failed with exit code 1

Если кто-то знает, почему Это говорит мне, что эта зависимость дублируется. Это мой файл pubspec.yaml

    # The following defines the version and build number for your application.
    # A version number is three numbers separated by dots, like 1.2.43
    # followed by an optional build number separated by a +.
    # Both the version and the builder number may be overridden in flutter
    # build by specifying --build-name and --build-number, respectively.
    # In Android, build-name is used as versionName while build-number used as versionCode.
    # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
    # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
    # Read more about iOS versioning at
    # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
    version: 1.0.0+1

    environment:
      sdk: ">=2.1.0 <3.0.0"

    dependencies:
      flutter:
        sdk: flutter

      # The following adds the Cupertino Icons font to your application.
      # Use with the CupertinoIcons class for iOS style icons.
      google_maps_flutter: ^0.5.21+11
      cupertino_icons: ^0.1.2
      flutter_signin_button: ^1.0.0
      font_awesome_flutter: ^8.5.0
      flutter_screenutil: ^0.6.1
      http: 0.12.0+2
      flutter_pdfview: ^1.0.0+9

    dev_dependencies:
      flutter_test:
        sdk: flutter

    # 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.
    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:
      #  - images/a_dot_burr.jpeg
      #  - images/a_dot_ham.jpeg
      assets:
        - assets/

      # An image asset can refer to one or more resolution-specific "variants", see
      # https://flutter.dev/assets-and-images/#resolution-aware.

      # For details regarding adding assets from package dependencies, see
      # https://flutter.dev/assets-and-images/#from-packages

      # To add custom fonts to your application, add a fonts section here,
      # in this "flutter" section. Each entry in this list should have a
      # "family" key with the font family name, and a "fonts" key with a
      # list giving the asset and other descriptors for the font. For
      # example:
      # fonts:
      #   - family: Schyler
      #     fonts:
      #       - asset: fonts/Schyler-Regular.ttf
      #       - asset: fonts/Schyler-Italic.ttf
      #         style: italic
      #   - family: Trajan Pro
      #     fonts:
      #       - asset: fonts/TrajanPro.ttf
      #       - asset: fonts/TrajanPro_Bold.ttf
      #         weight: 700
      #
      # For details regarding fonts from package dependencies,
      # see https://flutter.dev/custom-fonts/#from-packages
}
0
задан 27.11.2019, 02:35
1 ответ

Эта проблема может появляться по различным причинам:

  1. Несовместимость в твоем SdkVersion, поэтому рекомендует тебе гарантировать тебя, что minSdkVersion для твоего проекта - 20 или начальник. Минимальная часть для flutter_pdfview - 20.

android > app > buil.gradle

defaultConfig {
        minSdkVersion 20 // minSdkVersion
    }
  1. Мигрировать в AndroidX (, как мигрировать ) может предотвращать confritos между pluging или ошибками Gradle. Чтобы знать, использует ли твой проект AndroidX убедись в, что содержал android/gradle.properties:
android.useAndroidX=true
android.enableJetifier=true

В конце концов, скроллируй flutter clean и составь твой проект.

0
ответ дан 01.12.2019, 10:46
  • 1
    Я я не функционирую :( и кроме того присоединились эти линии перед ошибкой, которую я поместил. > Заметьте: Some неудар в лунку поля использовал unchecked or unsafe operations. > Заметьте: Повторно составьте with-Xlint:unchecked for details. – Ladislao Bacarrezza 28.11.2019, 02:17
  • 2
    Расследуя немного больше я вижу, что tambié n несовместимость, связанная с AndroidX может вызывать ошибку, поэтому измените мой ответ, я надеюсь и я ты функционировал. – Haniel Obed Baez 29.11.2019, 01:34