Flutter混合项目构建问题集锦

记录一次AS偶发异常导致的项目构建失败问题

以下是报错信息

Could not determine the dependencies of task ‘:app:mergeCeshiDebugAssets’.
Could not resolve all task dependencies for configuration ‘:app:CeshiDebugRuntimeClasspath’.
Could not resolve project :flutter.
Required by:
project :app
No matching configuration of project :flutter was found. The consumer was configured to find a runtime of a component, as well as attribute ‘com.android.build.api.attributes.BuildTypeAttr’ with value ‘debug’, attribute ‘stage’ with value ‘Ceshi’, attribute ‘org.jetbrains.kotlin.platform.type’ with value ‘androidJvm’ but:
- None of the consumable configurations have attributes.

通过排查、尝试,可以尝试一下操作:

  • 将报错的对应构建文件删除(这个步骤具体需要看是否在以上报错前还有报其他错误条件,这边是还有其他报错的,删完就没再报了)
  • 清一下缓存重启AS(这个步骤仅属于稳妥操作)
  • 切到Flutter组件下,执行一下命令:
flutter clean
flutter pub get
  • 重新构建,构建成功。

你可能感兴趣的:(#,Flutter——混合开发,Flutter,flutter)