任务 ':camera:compileDebugJavaWithJavac' 执行失败
Execution failed for task ':camera:compileDebugJavaWithJavac'
我创建了一个新的 flutter 项目并添加了 camera
插件。添加该依赖项后,我遇到了很多错误。我用的futter版本是2.5.2
& minSdkVersion 21
在pubspec.yaml
文件中,
environment:
sdk: ">=2.12.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.4
camera: ^0.9.4+4
错误如下,
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\Camera.java:23: error: cannot find symbol
import android.media.EncoderProfiles;
^
symbol: class EncoderProfiles
location: package android.media
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\Camera.java:935: error: cannot find symbol
EncoderProfiles getRecordingProfile() {
^
symbol: class EncoderProfiles
location: class Camera
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:10: error: cannot find symbol
import android.media.EncoderProfiles;
^
symbol: class EncoderProfiles
location: package android.media
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:29: error: cannot find symbol
private EncoderProfiles recordingProfile;
^
symbol: class EncoderProfiles
location: class ResolutionFeature
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:63: error: cannot find symbol
public EncoderProfiles getRecordingProfile() {
^
symbol: class EncoderProfiles
location: class ResolutionFeature
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:187: error: cannot find symbol
public static EncoderProfiles getBestAvailableCamcorderProfileForResolutionPreset(
^
symbol: class EncoderProfiles
location: class ResolutionFeature
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\media\MediaRecorderBuilder.java:8: error: cannot find symbol
import android.media.EncoderProfiles;
^
symbol: class EncoderProfiles
location: package android.media
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\media\MediaRecorderBuilder.java:24: error: cannot find symbol
private final EncoderProfiles encoderProfiles;
^
symbol: class EncoderProfiles
location: class MediaRecorderBuilder
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\media\MediaRecorderBuilder.java:36: error: cannot find symbol
@NonNull EncoderProfiles encoderProfiles, @NonNull String outputFilePath) {
^
symbol: class EncoderProfiles
location: class MediaRecorderBuilder
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\media\MediaRecorderBuilder.java:51: error: cannot find symbol
@NonNull EncoderProfiles encoderProfiles,
^
symbol: class EncoderProfiles
location: class MediaRecorderBuilder
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:186: error: cannot find symbol
@TargetApi(Build.VERSION_CODES.S)
^
symbol: variable S
location: class VERSION_CODES
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\Camera.java:208: error: reference to MediaRecorderBuilder is ambiguous
mediaRecorderBuilder = new MediaRecorderBuilder(getRecordingProfileLegacy(), outputFilePath);
^
both constructor MediaRecorderBuilder(CamcorderProfile,String) in MediaRecorderBuilder and constructor MediaRecorderBuilder(EncoderProfiles,String) in MediaRecorderBuilder match
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:118: error: cannot find symbol
EncoderProfiles profile =
^
symbol: class EncoderProfiles
location: class ResolutionFeature
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:120: error: package EncoderProfiles does not exist
List<EncoderProfiles.VideoProfile> videoProfiles = profile.getVideoProfiles();
^
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:121: error: package EncoderProfiles does not exist
EncoderProfiles.VideoProfile defaultVideoProfile = videoProfiles.get(0);
^
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:200: error: cannot find symbol
return CamcorderProfile.getAll(cameraIdString, CamcorderProfile.QUALITY_HIGH);
^
symbol: method getAll(String,int)
location: class CamcorderProfile
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:204: error: cannot find symbol
return CamcorderProfile.getAll(cameraIdString, CamcorderProfile.QUALITY_2160P);
^
symbol: method getAll(String,int)
location: class CamcorderProfile
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:208: error: cannot find symbol
return CamcorderProfile.getAll(cameraIdString, CamcorderProfile.QUALITY_1080P);
^
symbol: method getAll(String,int)
location: class CamcorderProfile
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:212: error: cannot find symbol
return CamcorderProfile.getAll(cameraIdString, CamcorderProfile.QUALITY_720P);
^
symbol: method getAll(String,int)
location: class CamcorderProfile
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:216: error: cannot find symbol
return CamcorderProfile.getAll(cameraIdString, CamcorderProfile.QUALITY_480P);
^
symbol: method getAll(String,int)
location: class CamcorderProfile
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:220: error: cannot find symbol
return CamcorderProfile.getAll(cameraIdString, CamcorderProfile.QUALITY_QVGA);
^
symbol: method getAll(String,int)
location: class CamcorderProfile
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:224: error: cannot find symbol
return CamcorderProfile.getAll(cameraIdString, CamcorderProfile.QUALITY_LOW);
^
symbol: method getAll(String,int)
location: class CamcorderProfile
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:241: error: package EncoderProfiles does not exist
List<EncoderProfiles.VideoProfile> videoProfiles = recordingProfile.getVideoProfiles();
^
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:243: error: package EncoderProfiles does not exist
EncoderProfiles.VideoProfile defaultVideoProfile = videoProfiles.get(0);
^
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\media\MediaRecorderBuilder.java:32: error: reference to MediaRecorderBuilder is ambiguous
this(camcorderProfile, outputFilePath, new MediaRecorderFactory());
^
both constructor MediaRecorderBuilder(CamcorderProfile,String,MediaRecorderFactory) in MediaRecorderBuilder and constructor MediaRecorderBuilder(EncoderProfiles,String,MediaRecorderFactory) in MediaRecorderBuilder match
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\media\MediaRecorderBuilder.java:79: error: package EncoderProfiles does not exist
EncoderProfiles.VideoProfile videoProfile = encoderProfiles.getVideoProfiles().get(0);
^
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\media\MediaRecorderBuilder.java:80: error: package EncoderProfiles does not exist
EncoderProfiles.AudioProfile audioProfile = encoderProfiles.getAudioProfiles().get(0);
^
27 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':camera:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 16s
Exception: Gradle task assembleDebug failed with exit code 1
我尝试清除缓存,但同样出现此问题。
这个怎么样?
flutter pub cache repair
尝试将您的 compileSdkVersion
和 targetSdkVersion
更新为 31。
我花了一天时间得出结论,我们需要升级我们的 flutter 版本后,我遇到了同样的问题。
flutter upgrade
或者
flutter upgrade --force
只需将您的 compileSdkVersion
更改为 31。因为我在更改 targetSdkVersion
时遇到了更多错误
尝试将您的 compileSdkVersion
和 targetSdkVersion
更改为 31。
如果这不起作用,请更改您的 pubspec.yaml
并添加:
camera:
git:
url: https://github.com/flutter/plugins
path: packages/camera/camera
ref: 9e46048ad2e1f085c1e8f6c77391fa52025e681f
您可以在此处检查修复:https://github.com/flutter/plugins/pull/4423
我创建了一个新的 flutter 项目并添加了 camera
插件。添加该依赖项后,我遇到了很多错误。我用的futter版本是2.5.2
& minSdkVersion 21
在pubspec.yaml
文件中,
environment:
sdk: ">=2.12.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.4
camera: ^0.9.4+4
错误如下,
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\Camera.java:23: error: cannot find symbol
import android.media.EncoderProfiles;
^
symbol: class EncoderProfiles
location: package android.media
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\Camera.java:935: error: cannot find symbol
EncoderProfiles getRecordingProfile() {
^
symbol: class EncoderProfiles
location: class Camera
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:10: error: cannot find symbol
import android.media.EncoderProfiles;
^
symbol: class EncoderProfiles
location: package android.media
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:29: error: cannot find symbol
private EncoderProfiles recordingProfile;
^
symbol: class EncoderProfiles
location: class ResolutionFeature
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:63: error: cannot find symbol
public EncoderProfiles getRecordingProfile() {
^
symbol: class EncoderProfiles
location: class ResolutionFeature
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:187: error: cannot find symbol
public static EncoderProfiles getBestAvailableCamcorderProfileForResolutionPreset(
^
symbol: class EncoderProfiles
location: class ResolutionFeature
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\media\MediaRecorderBuilder.java:8: error: cannot find symbol
import android.media.EncoderProfiles;
^
symbol: class EncoderProfiles
location: package android.media
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\media\MediaRecorderBuilder.java:24: error: cannot find symbol
private final EncoderProfiles encoderProfiles;
^
symbol: class EncoderProfiles
location: class MediaRecorderBuilder
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\media\MediaRecorderBuilder.java:36: error: cannot find symbol
@NonNull EncoderProfiles encoderProfiles, @NonNull String outputFilePath) {
^
symbol: class EncoderProfiles
location: class MediaRecorderBuilder
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\media\MediaRecorderBuilder.java:51: error: cannot find symbol
@NonNull EncoderProfiles encoderProfiles,
^
symbol: class EncoderProfiles
location: class MediaRecorderBuilder
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:186: error: cannot find symbol
@TargetApi(Build.VERSION_CODES.S)
^
symbol: variable S
location: class VERSION_CODES
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\Camera.java:208: error: reference to MediaRecorderBuilder is ambiguous
mediaRecorderBuilder = new MediaRecorderBuilder(getRecordingProfileLegacy(), outputFilePath);
^
both constructor MediaRecorderBuilder(CamcorderProfile,String) in MediaRecorderBuilder and constructor MediaRecorderBuilder(EncoderProfiles,String) in MediaRecorderBuilder match
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:118: error: cannot find symbol
EncoderProfiles profile =
^
symbol: class EncoderProfiles
location: class ResolutionFeature
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:120: error: package EncoderProfiles does not exist
List<EncoderProfiles.VideoProfile> videoProfiles = profile.getVideoProfiles();
^
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:121: error: package EncoderProfiles does not exist
EncoderProfiles.VideoProfile defaultVideoProfile = videoProfiles.get(0);
^
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:200: error: cannot find symbol
return CamcorderProfile.getAll(cameraIdString, CamcorderProfile.QUALITY_HIGH);
^
symbol: method getAll(String,int)
location: class CamcorderProfile
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:204: error: cannot find symbol
return CamcorderProfile.getAll(cameraIdString, CamcorderProfile.QUALITY_2160P);
^
symbol: method getAll(String,int)
location: class CamcorderProfile
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:208: error: cannot find symbol
return CamcorderProfile.getAll(cameraIdString, CamcorderProfile.QUALITY_1080P);
^
symbol: method getAll(String,int)
location: class CamcorderProfile
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:212: error: cannot find symbol
return CamcorderProfile.getAll(cameraIdString, CamcorderProfile.QUALITY_720P);
^
symbol: method getAll(String,int)
location: class CamcorderProfile
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:216: error: cannot find symbol
return CamcorderProfile.getAll(cameraIdString, CamcorderProfile.QUALITY_480P);
^
symbol: method getAll(String,int)
location: class CamcorderProfile
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:220: error: cannot find symbol
return CamcorderProfile.getAll(cameraIdString, CamcorderProfile.QUALITY_QVGA);
^
symbol: method getAll(String,int)
location: class CamcorderProfile
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:224: error: cannot find symbol
return CamcorderProfile.getAll(cameraIdString, CamcorderProfile.QUALITY_LOW);
^
symbol: method getAll(String,int)
location: class CamcorderProfile
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:241: error: package EncoderProfiles does not exist
List<EncoderProfiles.VideoProfile> videoProfiles = recordingProfile.getVideoProfiles();
^
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\features\resolution\ResolutionFeature.java:243: error: package EncoderProfiles does not exist
EncoderProfiles.VideoProfile defaultVideoProfile = videoProfiles.get(0);
^
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\media\MediaRecorderBuilder.java:32: error: reference to MediaRecorderBuilder is ambiguous
this(camcorderProfile, outputFilePath, new MediaRecorderFactory());
^
both constructor MediaRecorderBuilder(CamcorderProfile,String,MediaRecorderFactory) in MediaRecorderBuilder and constructor MediaRecorderBuilder(EncoderProfiles,String,MediaRecorderFactory) in MediaRecorderBuilder match
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\media\MediaRecorderBuilder.java:79: error: package EncoderProfiles does not exist
EncoderProfiles.VideoProfile videoProfile = encoderProfiles.getVideoProfiles().get(0);
^
C:\Users\Lakshan\Documents\SDKs\flutter\.pub-cache\hosted\pub.dartlang.org\camera-0.9.4+4\android\src\main\java\io\flutter\plugins\camera\media\MediaRecorderBuilder.java:80: error: package EncoderProfiles does not exist
EncoderProfiles.AudioProfile audioProfile = encoderProfiles.getAudioProfiles().get(0);
^
27 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':camera:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 16s
Exception: Gradle task assembleDebug failed with exit code 1
我尝试清除缓存,但同样出现此问题。
这个怎么样?
flutter pub cache repair
尝试将您的 compileSdkVersion
和 targetSdkVersion
更新为 31。
我花了一天时间得出结论,我们需要升级我们的 flutter 版本后,我遇到了同样的问题。
flutter upgrade
或者
flutter upgrade --force
只需将您的 compileSdkVersion
更改为 31。因为我在更改 targetSdkVersion
尝试将您的 compileSdkVersion
和 targetSdkVersion
更改为 31。
如果这不起作用,请更改您的 pubspec.yaml
并添加:
camera:
git:
url: https://github.com/flutter/plugins
path: packages/camera/camera
ref: 9e46048ad2e1f085c1e8f6c77391fa52025e681f
您可以在此处检查修复:https://github.com/flutter/plugins/pull/4423