尝试向我的应用添加以下依赖项:
// CameraX core library
def camerax_version = "1.0.0-beta01"
implementation "androidx.camera:camera-core:$camerax_version"
// CameraX Camera2 extensions
implementation "androidx.camera:camera-camera2:$camerax_version"
// CameraX Lifecycle library
implementation "androidx.camera:camera-lifecycle:$camerax_version"
// CameraX View class
implementation "androidx.camera:camera-view:1.0.0-alpha08"
我收到以下错误:
> Task :app:mergeDebugResources
AGPBI: {"kind":"error","text":"Android resource compilation failed","sources":[{"file":"/Users/adam/.gradle/caches/transforms-2/files-2.1/ebbf69df6983e5bff0cfe1365273c65d/camera-view-1.0.0-alpha08/res/values/values.xml","position":{"startLine":2,"startColumn":4,"startOffset":55,"endLine":24,"endColumn":24,"endOffset":901}}],"original":"/Users/adam/.gradle/caches/transforms-2/files-2.1/ebbf69df6983e5bff0cfe1365273c65d/camera-view-1.0.0-alpha08/res/values/values.xml:3:5-25:25: AAPT: error: duplicate value for resource 'attr/scaleType' with config ''.\n ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource compilation failed","sources":[{"file":"/Users/adam/.gradle/caches/transforms-2/files-2.1/ebbf69df6983e5bff0cfe1365273c65d/camera-view-1.0.0-alpha08/res/values/values.xml","position":{"startLine":2,"startColumn":4,"startOffset":55,"endLine":24,"endColumn":24,"endOffset":901}}],"original":"/Users/adam/.gradle/caches/transforms-2/files-2.1/ebbf69df6983e5bff0cfe1365273c65d/camera-view-1.0.0-alpha08/res/values/values.xml:3:5-25:25: AAPT: error: resource previously defined here.\n ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource compilation failed","sources":[{"file":"/Users/adam/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml"}],"original":"/Users/adam/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml: AAPT: error: file failed to compile.\n ","tool":"AAPT"}
> Task :app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
/Users/adam/.gradle/caches/transforms-2/files-2.1/ebbf69df6983e5bff0cfe1365273c65d/camera-view-1.0.0-alpha08/res/values/values.xml:3:5-25:25: AAPT: error: duplicate value for resource 'attr/scaleType' with config ''.
/Users/adam/.gradle/caches/transforms-2/files-2.1/ebbf69df6983e5bff0cfe1365273c65d/camera-view-1.0.0-alpha08/res/values/values.xml:3:5-25:25: AAPT: error: resource previously defined here.
/Users/adam/android/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml: AAPT: error: file failed to compile.
错误和相关文件的屏幕截图:
我可以通过删除以下依赖项来成功编译:
// CameraX View class
implementation "androidx.camera:camera-view:1.0.0-alpha08"