如何在pubspec.lock中删除未使用的插件。

huangapple go评论72阅读模式
英文:

how to remove unused plugin in pubspec.lock

问题

例如,我刚刚从webview_flutter更改为flutter_webview_pro。

当我尝试运行flutter build apk --split-per-abi时,出现以下错误:

在执行com.android.build.gradle.internal.tasks.Workers$ActionFacade时发生故障

com.android.builder.dexing.DexArchiveMergerException: 合并dex存档时出错:
了解如何解决此问题,请访问https://developer.android.com/studio/build/dependencies#duplicate_classes。
类型io.flutter.plugins.webviewflutter.BuildConfig在多处定义:/Users/mypc/ccc/myapps/build/webview_pro_android/.transforms/bdbf64f9d3abc9a772a513f41adb1eaa/classes/classes.dex,/Users/mypc/ccc/myapps/build/webview_flutter_android/.transforms/11582e4deb0c75876ac071bae0201050/classes/classes.de

之后,我检查了pubspec.lock、.flutter-plugins和.flutter-plugins-dependencies,之前的包'webview_flutter'仍然存在。

我尝试创建新项目,但在更改这些包时没有遇到相同的问题,pubspec.lock正常生成。

英文:

for example, i just change from webview_flutter to flutter_webview_pro.

and when i try flutter build apk --split-per-abi, this error comes out :

failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade

> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
> Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
> Type io.flutter.plugins.webviewflutter.BuildConfig is defined multiple times: /Users/mypc/ccc/myapps/build/webview_pro_android/.transforms/bdbf64f9d3abc9a772a513f41adb1eaa/classes/classes.dex, /Users/mypc/ccc/myapps/build/webview_flutter_android/.transforms/11582e4deb0c75876ac071bae0201050/classes/classes.de

after that i check pubspec.lock, .flutter-plugins and .flutter-plugins-dependencies, the previous packages 'webview_flutter' still remaining

i try creating new project but i don't have the same issues while change those packages, the pubspec.lock generate normally

答案1

得分: 1

删除 pubspec.lock 文件。

然后运行 flutter clean

然后运行 flutter pub get

在运行上述命令之后,pubspec.lock 文件将自动生成。

英文:

Delete pubspec.lock file.

then run flutter clean.

then run flutter pub get

after run above command pubspec.lock file ganerate automatically.

huangapple
  • 本文由 发表于 2023年7月10日 14:01:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/76651001.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定