wilddog_auth
和wilddog_sync
。我可以从pubspec.yaml
文件以及我的Dart文件中移除引用(例如删除import 'package:wilddog_sync/wilddog_sync.dart'
等),也可以从MainActivity.java以及Xcode项目中移除引用,但无法清除Flutter、cocoapod和gradle安装的未使用文件。 现在,是否有一个统一的命令可以一次性删除所有未使用的包?我非常确定只使用
flutter clean
只会删除 build 文件夹,而在从pubspec.yaml
文件中移除包后使用flutter packages get
并不会删除或中的包。例如,在执行完
flutter clean
和flutter packages get
之后,我重新构建了该项目:Launching lib/main.dart on Android SDK built for x86 64 in debug mode...
Initializing gradle...
Resolving dependencies...
Running 'gradlew assembleDebug'...
Built build/app/outputs/apk/debug/app-debug.apk.
Installing build/app/outputs/apk/app.apk...
I/FlutterActivityDelegate(11331): onResume setting current activity to this
I/Choreographer(11331): Skipped 107 frames! The application may be doing too much work on its main thread.
D/EGL_emulation(11331): eglMakeCurrent: 0x79f21b4dbec0: ver 2 0 (tinfo 0x79f219b4f160)
I/OpenGLRenderer(11331): Davey! duration=1903ms; Flags=1, IntendedVsync=7544454683637, Vsync=7546238016899, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=7546253803603, AnimationStart=7546253996603, PerformTraversalsStart=7546254171603, DrawStart=7546279222603, SyncQueued=7546288526603, SyncStart=7546295569603, IssueDrawCommandsStart=7546296644603, SwapBuffers=7546334455603, FrameCompleted=7546365204603, DequeueBufferDuration=2892000, QueueBufferDuration=199000,
Syncing files to device Android SDK built for x86 64...
D/ (11331): HostConnection::get() New Host Connection established 0x79f219ab81e0, tid 11383
D/EGL_emulation(11331): eglMakeCurrent: 0x79f21b5e26e0: ver 2 0 (tinfo 0x79f219aa66c0)
W/IInputConnectionWrapper(11331): getCursorCapsMode on inactive InputConnection
但所有的包文件都保留下来了。
当然,我可以进入./ios/
并运行pods install
来删除cocoapods:
pod install
Analyzing dependencies
Fetching podspec for `Flutter` from `.symlinks/flutter/ios`
Removing Wilddog
Removing WilddogCore
Removing WilddogSync
Downloading dependencies
Using Flutter (1.0.0)
Generating Pods project
Integrating client project
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
[!] Automatically assigning platform `ios` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
pubspec.yaml
中删除它们并运行flutter packages get
即可。 - Günter Zöchbauerflutter clean
命令。 - Yaminflutter packages get
。当您重新构建项目时,Flutter会自动删除本地插件代码。 - boformerflutter build
命令吗?我重新构建成功了,但gradle和cocoapods中的所有文件都保留不变。 - Aero Wangpubspec.yaml
中删除条目是我做的第一件事。在./ios/
中运行pod install
以删除Xcode项目中未使用的软件包显然是有效的(但您必须先修改Xcode项目)。我的目标是减少我需要执行的清理软件包的步骤。 - Aero Wang