Android Camera2 样本

Android Camera2 Sample

我正在尝试为 android 寻找相机样本,因为我很想弄乱它,看看我能做些什么。我正在使用 "Import an android code sample" 中的示例代码并使用 Camera2。我有点明白它是如何工作的,但是我想在我的 phone 上尝试它,它是 android 4.4,而 5.0 是唯一需要的版本。最小 sdk 是 5.0,如果更改错误是。 `错误:任务 ':Application:processDebugTestManifest' 执行失败。

com.android.manifmerger.ManifestMerger2$MergeFailureException: org.xml.sax.SAXParseException; lineNumber: 20; columnNumber: 10; The processing instruction target matching "[xX][mM][lL]" is not allowed.`

错误是这样的,它说 "Declarations must proceed all document content" 它还说无法解析 camera2basic 的符号

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->


<instrumentation
        android:name="android.test.InstrumentationTestRunner"
        android:targetPackage="com.example.android.camera2basic"
        android:label="Tests for com.example.android.camera2basic" />

所以我的问题是有没有一种方法可以让更多的人访问它而不仅仅是棒棒糖?或者是否有另一个示例代码可供我用来玩弄

camera2 API 在 Android 5.0 之前不存在,因此您不能在 运行 Android 4.4.

设备上使用它

您可以在此处按照旧相机 API 的 API 指南进行操作: http://developer.android.com/guide/topics/media/camera.html#custom-camera