Flutter:- already_active,图像选择器已经激活,null,null

Flutter:- already_active, Image picker is already active, null, null

每次我在发布模式下按选择图像时,它都会向我显示此错误

E/flutter (24004): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: PlatformException(already_active, Image picker is already active, null, null)
E/flutter (24004): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:581)
E/flutter (24004): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:158)
E/flutter (24004): <asynchronous suspension>
E/flutter (24004): #2      MethodChannelImagePicker.pickImage (package:image_picker_platform_interface/src/method_channel/method_channel_image_picker.dart:29)
E/flutter (24004): <asynchronous suspension>
E/flutter (24004): #3      _UploadDataCardState.getImage (package:visual_retail/screens/FillData/UploadDataCard.dart:164)
E/flutter (24004): <asynchronous suspension>
E/flutter (24004):

在调试模式下它工作正常

将 Gradle 版本降级为:类路径 'com.android.tools.build:gradle:3.5.4'

降级后Gradle版本更改kotlin版本
这是我 ext.kotlin_version = '1.6.10' 'com.android.tools.build:gradle:4.1.0'

的版本

找到你的

buildscript {
    ext.kotlin_version = '1.6.10'
    repositories {
        google()
        mavenCentral()
    }