【问题标题】:Camera2 API doesn't work on emualtorCamera2 API 在模拟器上不起作用
【发布时间】:2017-07-04 12:21:32
【问题描述】:

我正在尝试在模拟器上使用 Camera2 API,但不幸的是我在实现它时遇到了问题。

我正在使用 google 从 link 提供的 Camera2Basic,我在真实设备上试用过,效果很好。

真实设备有:Huawei P9 Lite API 24、Samsung Galaxy S5 API 23。

Genymotion 模拟器是: Google Nexus 4,5,6 API 21,22,24,Samsung Galaxy S6,S7 API 23,25

现在的问题是,在模拟器上启动应用程序时,它会显示相机(我正在使用网络摄像头),但是当我通常单击按钮图片时,它会在吐司上显示图片保存在特定路径中。但事实并非如此,这意味着这张照片不是拍摄的,它只在真实设备上拍摄。

我在构建项目时注意到 logcat 显示了这一点:

07-04 07:56:06.252 1694-1694/? E/memtrack: Couldn't load memtrack module (No 
such file or directory)
07-04 07:56:06.252 1694-1694/? E/android.os.Debug: failed to load memtrack 
module: -2
07-04 07:56:07.360 1709-1709/? E/memtrack: Couldn't load memtrack module (No 
such file or directory)
07-04 07:56:07.360 1709-1709/? E/android.os.Debug: failed to load memtrack 
module: -2
07-04 07:56:34.492 1723-1723/? E/memtrack: Couldn't load memtrack module (No 
such file or directory)
07-04 07:56:34.492 1723-1723/? E/android.os.Debug: failed to load memtrack 
module: -2
07-04 07:56:35.220 1816-1816/? E/cutils-trace: Error opening trace file: 
Permission denied (13)
07-04 07:56:37.443 1863-1863/? E/memtrack: Couldn't load memtrack module (No 
such file or directory)
07-04 07:56:37.444 1863-1863/? E/android.os.Debug: failed to load memtrack 
module: -2
07-04 07:56:38.734 1872-1909/com.example.android.camera2basic E/libEGL: 
load_driver(/system/lib/egl/libGLES_emulation.so): dlopen failed: library 
"/system/lib/egl/libGLES_emulation.so" not found
07-04 07:56:39.621 1872-1909/com.example.android.camera2basic 
E/EGL_emulation: tid 1909: eglSurfaceAttrib(1174): error 0x3009 
(EGL_BAD_MATCH)
07-04 07:56:40.775 635-727/system_process E/TaskPersister: File error 
accessing recents directory (directory doesn't exist?).
07-04 07:56:44.003 1935-1981/com.android.packageinstaller E/libEGL: 
load_driver(/system/lib/egl/libGLES_emulation.so): dlopen failed: library 
"/system/lib/egl/libGLES_emulation.so" not found
07-04 07:56:44.597 1935-1981/com.android.packageinstaller E/EGL_emulation: 
tid 1981: eglSurfaceAttrib(1174): error 0x3009 (EGL_BAD_MATCH)

但是当我点击按钮 picture 时,它在 logcat 上什么也没有显示。这是 AndroidManifest.xml 文件:

<?xml version="1.0" encoding="UTF-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.camera2basic">

<uses-permission android:name="android.permission.CAMERA" />

<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application android:allowBackup="true"
    android:label="@string/app_name"
    android:icon="@drawable/ic_launcher"
    android:theme="@style/MaterialTheme">

    <activity android:name=".CameraActivity"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

我看到很多关于“无法加载 memtrack 模块(否 这样的文件或目录)”,但我无法真正与它们联系起来。有人可以帮忙吗?提前谢谢你。

P.S : 让 Camera2 API 在模拟器上工作是我的项目必须的,这就是我问这个的原因。谢谢理解

【问题讨论】:

    标签: android android-emulator android-camera


    【解决方案1】:

    您是否在 Android Studio 模拟器中尝试过?它在那里工作吗?

    这可能是 Genymotion 模拟器特有的错误,也可能在多个模拟器之间共享。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-11
      • 2018-05-17
      • 1970-01-01
      相关资源
      最近更新 更多