簡體   English   中英

將webview_flutter插件更新到最新版本時遇到問題(0.3.6)

[英]trouble when updating webview_flutter plugin to latest version (0.3.6)

我正在嘗試將我的flutter_webview插件版本升級到最新版本。

目前我在v0.2.0上,一切正常。 在pubspec.yaml中將其更新為v0.3.6並運行flutter run之后我得到:

Note: Some input files use or override 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

然后我更新了我的build.gradle文件,在build.gradle的defaultConfig部分添加了一行,如下所示:

multiDexEnabled true

這樣做之后,我得到了這個:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
com.android.build.api.transform.TransformException: Error while generating the main dex list.

接下來,我進入了我的build.gradle文件並將我的gradle版本從3.2.1更新到3.3.2。 這樣做之后我得到了這個:

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
D8: Program type already present: android.support.v4.app.INotificationSideChannel$Stub$Proxy

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
 com.android.build.api.transform.TransformException: Error while generating the main dex list:
  Error while merging dex archives: 
  Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
  Program type already present: android.support.v4.app.INotificationSideChannel$Stub$Proxy

我進入gradle.properties並添加了兩行:

android.useAndroidX=true
android.enableJetifier=true

..結果得到了大量這樣的消息:

Resolving dependencies...                                           3.9s
c:\src\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_custom_tabs-0.4.0\android\src\main\java\com\github\droibit\flutter\plugins\customtabs\CustomTabsPlugin.java:7: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
                                 ^
c:\src\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_custom_tabs-0.4.0\android\src\main\java\com\github\droibit\flutter\plugins\customtabs\CustomTabsPlugin.java:8: error: cannot find symbol
import android.support.customtabs.CustomTabsIntent;

正如你可能會說的那樣,我不是gradle的專家,而且我現在基本上都在徘徊,閱讀堆棧溢出帖子並試圖找到一些有效的魔法組合。 有人會想到我可以嘗試解決原始問題的方法嗎?

如果它有幫助,我在Android Studio中打開了我的項目並嘗試通過選擇Refactor - > Migrate to AndroidX升級到AndroidX,並被告知我沒有使用AndroidX。

[編輯]這里是我的pubspec.yaml文件的內容:

# 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
  webfeed: ^0.4.2
  http: 0.12.0
  flutter_bloc: 0.9.1
  equatable: ^0.2.0
  flutter_html_view: ^0.5.11
  webview_flutter: ^0.2.0
  html2md: ^0.2.1

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2

dev_dependencies:
  flutter_test:
    sdk: flutter


# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/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

好的,我錯過了這個錯誤。 似乎正在發生的是與flutter_html_view的沖突。 如果我從我的應用程序中刪除該包(以及它的所有用途),事情就會重新開始。 我還更新了一些其他依賴項到他們的最新版本,到目前為止,我的pubspec.yaml dependecies部分看起來像:

dependencies:
  flutter:
    sdk: flutter
  webfeed: ^0.4.2
  http: 0.12.0
  flutter_bloc: 0.13.0
  #equatable: ^0.2.0
  #flutter_html_view: ^0.5.11
  webview_flutter: ^0.3.6
  html2md: ^0.2.1

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2 

我很想知道將來如何分析這些類型的依賴問題,因為我對此的“解決方案”涉及升級所有依賴項,然后刪除對(和使用代碼) flutter_html_view - 我很幸運,如果必須找出flutter_html_view的替代品被認為是幸運的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM