gpt4 book ai didi

android - 任务 ':camera:compileDebugJavaWithJavac' 执行失败

转载 作者:行者123 更新时间:2023-12-04 23:36:25 27 4
gpt4 key购买 nike

我创建了一个新的 flutter 项目并添加了 camera 插入。添加该依赖项后,我遇到了很多错误。我用的 futter 版本是 2.5.2 & minSdkVersion 21pubspec.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
我尝试清除缓存,但同样出现此问题。

最佳答案

尝试更新您的 compileSdkVersiontargetSdkVersion到 31。

关于android - 任务 ':camera:compileDebugJavaWithJavac' 执行失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69999966/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com