Android 尝试为颤振应用程序生成发布apk时出错-无法解析项目:颤振\u图像\u压缩

Android 尝试为颤振应用程序生成发布apk时出错-无法解析项目:颤振\u图像\u压缩,android,gradle,flutter,Android,Gradle,Flutter,我正在尝试为我的应用程序构建发布apk。我得到以下错误 flutter build apk --release $ flutter build apk --release Initializing gradle... 2.8s Resolving dependencies... 8.8s FAILURE: Build failed with an e

我正在尝试为我的应用程序构建发布apk。我得到以下错误

flutter build apk --release
$ flutter build apk --release
Initializing gradle...                                       2.8s
Resolving dependencies...                                    8.8s

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':app:dynamicProfileRuntimeClasspath'.
   > Could not resolve project :flutter_image_compress.
     Required by:
         project :app
      > Could not select value from candidates [null, debug, release] using AlternateDisambiguationRule.BuildTypeRule.
         > java.lang.NullPointerException (no error message)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
关于为什么会发生这个问题有什么建议吗?

这个插件“颤振图像压缩”给了你一个问题。这可能是由于插件和您的项目之间不兼容造成的

您可以尝试的几件事:

  • 在android/build.gradle中添加以下行
  • lint选项{
    禁用“InvalidPackage”
    checkReleaseBuilds为false
    }