Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Camera2Basic failed to open camera normally

未关闭
#545 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
android, kotlin
领域
mobile

调研方向

在只有前置摄像头的设备上,在 Android Studio 中重现 Camera2Basic 的启动失败,从 CameraActivity 和日志指出的打开摄像头路径开始。比较第一次成功启动与后续启动,并使用报告的启动日志确定打开操作停止的位置。在退出、清除数据或重新安装后,示例能够可靠地打开前置摄像头,即表示完成。

由索引模型根据 Issue 内容生成。

描述

After I import Camera2Basic into Android Studio and run it (My device only has front camera)

for the first time, camera opened normally, then no matter I exit camera, clear the cache/data, uninstall the APP and reinstall it, camera still failed to open again. log from Android Studio is as below:

It seems stunk in the starting window, in the left-top window, it shows 'Front JPEG (0)'

2023-05-24 15:22:45.556  9183-9183  studio.deploy           pid-9183                             E  Could not remove dir '/data/data/com.android.example.camera2.basic/code_cache/.ll/': No such file or directory
---------------------------- PROCESS STARTED (9201) for package com.android.example.camera2.basic ----------------------------
2023-05-24 15:22:47.208  9201-9201  chatty                  com.android.example.camera2.basic    I  uid=10054(com.android.example.camera2.basic) re-initialized> identical 1 line
2023-05-24 15:22:47.209  9201-9201  e.camera2.basi          com.android.example.camera2.basic    W  Accessing hidden method Landroid/content/res/ResourcesKey;-><init>(Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;ILandroid/content/res/Configuration;Landroid/content/res/CompatibilityInfo;[Landroid/content/res/loader/ResourcesLoader;)V (blacklist, linking, denied)
2023-05-24 15:22:47.209  9201-9201  e.camera2.basi          com.android.example.camera2.basic    W  Accessing hidden method Landroid/app/ResourcesManager;->invalidatePath(Ljava/lang/String;)V (greylist-max-o, linking, denied)
2023-05-24 15:22:47.209  9201-9201  e.camera2.basi          com.android.example.camera2.basic    W  Accessing hidden method Landroid/content/res/ResourcesKey;->isPathReferenced(Ljava/lang/String;)Z (greylist-max-o, linking, denied)
2023-05-24 15:22:47.209  9201-9201  e.camera2.basi          com.android.example.camera2.basic    W  Accessing hidden field Landroid/app/ResourcesManager;->mCachedApkAssets:Landroid/util/ArrayMap; (greylist-max-o, linking, denied)
2023-05-24 15:22:47.209  9201-9201  e.camera2.basi          com.android.example.camera2.basic    W  Accessing hidden field Landroid/app/ResourcesManager;->mCachedApkAssets:Landroid/util/ArrayMap; (greylist-max-o, linking, denied)
2023-05-24 15:22:47.209  9201-9201  e.camera2.basi          com.android.example.camera2.basic    W  Accessing hidden field Landroid/app/ResourcesManager$ApkKey;->path:Ljava/lang/String; (greylist-max-o, linking, denied)
2023-05-24 15:22:47.209  9201-9201  e.camera2.basi          com.android.example.camera2.basic    W  Accessing hidden field Landroid/app/ResourcesManager;->mCachedApkAssets:Landroid/util/ArrayMap; (greylist-max-o, linking, denied)
2023-05-24 15:22:47.209  9201-9201  e.camera2.basi          com.android.example.camera2.basic    W  Accessing hidden method Landroid/content/res/ApkAssets;->close()V (blacklist, linking, denied)
2023-05-24 15:22:47.209  9201-9201  e.camera2.basi          com.android.example.camera2.basic    W  Accessing hidden field Landroid/app/ResourcesManager;->mCachedApkAssets:Landroid/util/ArrayMap; (greylist-max-o, linking, denied)
2023-05-24 15:22:47.209  9201-9201  e.camera2.basi          com.android.example.camera2.basic    W  Accessing hidden field Landroid/app/ResourcesManager$ApkKey;->path:Ljava/lang/String; (greylist-max-o, linking, denied)
2023-05-24 15:22:47.209  9201-9201  e.camera2.basi          com.android.example.camera2.basic    W  Accessing hidden field Landroid/app/ResourcesManager;->mCachedApkAssets:Landroid/util/ArrayMap; (greylist-max-o, linking, denied)
2023-05-24 15:22:47.209  9201-9201  e.camera2.basi          com.android.example.camera2.basic    W  Accessing hidden method Landroid/content/res/ApkAssets;->close()V (blacklist, linking, denied)
2023-05-24 15:22:47.210  9201-9201  e.camera2.basi          com.android.example.camera2.basic    W  Accessing hidden method Landroid/app/ResourcesManager;->isSameResourcesOverrideConfig(Landroid/os/IBinder;Landroid/content/res/Configuration;)Z (greylist-max-o, linking, denied)
2023-05-24 15:22:47.210  9201-9201  e.camera2.basi          com.android.example.camera2.basic    W  Accessing hidden field Landroid/app/ResourcesManager$ActivityResources;->overrideConfig:Landroid/content/res/Configuration; (greylist-max-o, linking, denied)
2023-05-24 15:22:47.210  9201-9201  chatty                  com.android.example.camera2.basic    I  uid=10054(com.android.example.camera2.basic) identical 1 line
2023-05-24 15:22:47.210  9201-9201  e.camera2.basi          com.android.example.camera2.basic    W  Accessing hidden field Landroid/app/ResourcesManager$ActivityResources;->overrideConfig:Landroid/content/res/Configuration; (greylist-max-o, linking, denied)
2023-05-24 15:22:47.210  9201-9201  e.camera2.basi          com.android.example.camera2.basic    W  Accessing hidden method Landroid/content/res/Configuration;->diffPublicOnly(Landroid/content/res/Configuration;)I (greylist-max-o, linking, denied)
2023-05-24 15:22:47.210  9201-9201  e.camera2.basi          com.android.example.camera2.basic    W  Accessing hidden method Landroid/app/ResourcesManager;->overrideTokenDisplayAdjustments(Landroid/os/IBinder;Ljava/util/function/Consumer;)Z (blacklist, linking, denied)
2023-05-24 15:22:47.210  9201-9201  e.camera2.basi          com.android.example.camera2.basic    W  Accessing hidden field Landroid/app/ResourcesManager$ActivityResources;->activityResources:Ljava/util/ArrayList; (greylist-max-o, linking, denied)
2023-05-24 15:22:47.210  9201-9201  e.camera2.basi          com.android.example.camera2.basic    W  Accessing hidden method Landroid/content/res/Resources;->overrideDisplayAdjustments(Ljava/util/function/Consumer;)V (blacklist, linking, denied)
2023-05-24 15:22:47.211  9201-9201  e.camera2.basi          com.android.example.camera2.basic    W  Accessing hidden method Landroid/app/ResourcesManager;->updateResourcesForActivity(Landroid/os/IBinder;Landroid/content/res/Configuration;IZ)V (greylist-max-o, linking, denied)
2023-05-24 15:22:47.211  9201-9201  e.camera2.basi          com.android.example.camera2.basic    W  Accessing hidden method Landroid/app/ResourcesManager;->getOrCreateActivityResourcesStructLocked(Landroid/os/IBinder;)Landroid/app/ResourcesManager$ActivityResources; (greylist-max-o, linking, denied)
2023-05-24 15:22:47.218  9201-9201  studio.deploy           com.android.example.camera2.basic    I  JVMTI::HiddenAPIWarning:Restoring not supported
2023-05-24 15:22:47.482  9201-9201  NetworkSecurityConfig   com.android.example.camera2.basic    D  No Network Security Config specified, using platform default
2023-05-24 15:22:47.483  9201-9201  NetworkSecurityConfig   com.android.example.camera2.basic    D  No Network Security Config specified, using platform default
2023-05-24 15:22:47.662  9201-9201  e.camera2.basi          com.android.example.camera2.basic    W  Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
2023-05-24 15:22:47.664  9201-9201  e.camera2.basi          com.android.example.camera2.basic    W  Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
2023-05-24 15:22:47.752  9201-9201  CameraManagerGlobal     com.android.example.camera2.basic    I  Connecting to camera service
2023-05-24 15:22:47.793  9201-9217  System                  com.android.example.camera2.basic    W  A resource failed to call close. 
2023-05-24 15:22:47.793  9201-9217  System                  com.android.example.camera2.basic    W  A resource failed to call close. 
2023-05-24 15:22:47.972   475-1511  BufferQueueProducer     surfaceflinger                       E  [com.android.example.camera2.basic/com.example.android.camera2.basic.CameraActivity#0](id:1db0000006e,api:0,p:-1,c:475) disconnect: not connected (req=1)
2023-05-24 15:22:47.972  9201-9226  libEGL                  com.android.example.camera2.basic    W  EGLNativeWindowType 0xeba00018 disconnect failed
主要语言
Kotlin
星标
5.5k
派生
2.4k
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

android/camera-samples 的其他 Issue

查看 android/camera-samples 的全部 Issue

相似的 Issue

更多 Kotlin Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。