You need to enable JavaScript to run this app. Android Studio应用真机运行正常 模拟器登录失败如何排查解决
优惠活动
大模型
产品
解决方案
定价
更多

Android Studio应用真机运行正常 模拟器登录失败如何排查解决

Android Studio模拟器登录异常问题排查与解决

问题场景

  • 开发基础环境:Mac mini 上使用Android Studio开展测试应用开发,前期全程通过虚拟设备模拟器完成全流程测试,应用编译、启动、登录功能均运行正常。
  • 异常触发背景:后续接入实体Android设备开展测试时,发现真机端应用运行、登录功能完全正常,但原有测试模拟器突发登录故障:应用可正常完成编译构建、启动到登录界面,但在模拟器端输入账号、密码且确认输入信息无误的情况下,始终返回登录失败提示。
  • 已尝试的无效排查动作:参考同类问题解决方案调大模拟器的内存、存储空间配置,问题未得到改善。

异常场景Logcat日志

2021-03-31 01:13:22.883 4028-4028/? I/libc: SetHeapTaggingLevel: tag level set to 0
2021-03-31 01:13:22.883 4028-4028/? I/zygote64: Disabled memory mitigations for process.
2021-03-31 01:13:22.911 4028-4028/? I/: Not late-enabling -Xcheck:jni (already on)
2021-03-31 01:13:22.919 4028-4028/? I/: Unquickening 12 vdex files!
2021-03-31 01:13:22.937 4028-4028/? D/CompatibilityChangeReporter: Compat change id reported: 171979766; UID 10121; state: DISABLED
2021-03-31 01:13:22.941 4028-4028/ D/ApplicationLoaders: Returning zygote-cached class loader: /system/framework/android.test.base.jar
2021-03-31 01:13:23.010 4028-4028/ D/NetworkSecurityConfig: No Network Security Config specified, using platform default
2021-03-31 01:13:23.010 4028-4028/ D/NetworkSecurityConfig: No Network Security Config specified, using platform default
2021-03-31 01:13:23.020 4028-4051/ D/libEGL: loaded /vendor/lib64/egl/libEGL_emulation.so
2021-03-31 01:13:23.020 4028-4051/ D/libEGL: loaded /vendor/lib64/egl/libGLESv1_CM_emulation.so
2021-03-31 01:13:23.021 4028-4051/ D/libEGL: loaded /vendor/lib64/egl/libGLESv2_emulation.so
2021-03-31 01:13:23.040 4028-4028/ W/: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (unsupported, reflection, allowed)
2021-03-31 01:13:23.040 4028-4028/ W/: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (unsupported, reflection, allowed)
2021-03-31 01:13:23.064 4028-4049/ D/HostConnection: createUnique: call
2021-03-31 01:13:23.065 4028-4049/ D/HostConnection: HostConnection::get() New Host Connection established 0x7c727832d0, tid 4049
2021-03-31 01:13:23.066 4028-4049/ D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_async_queue_submit GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_3_0 
2021-03-31 01:13:23.062 4028-4028/ W/RenderThread: type=1400 audit(0.0:280): avc: denied { create } for scontext=u:r:untrusted_app_27:s0:c121,c256,c512,c768 tcontext=u:r:untrusted_app_27:s0:c121,c256,c512,c768 tclass=vsock_socket permissive=0 app=
2021-03-31 01:13:23.067 4028-4049/ W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
2021-03-31 01:13:23.068 4028-4049/ D/EGL_emulation: eglCreateContext: 0x7c8277fb70: maj 3 min 0 rcv 3
2021-03-31 01:13:23.066 4028-4028/ W/RenderThread: type=1400 audit(0.0:281): avc: denied { create } for scontext=u:r:untrusted_app_27:s0:c121,c256,c512,c768 tcontext=u:r:untrusted_app_27:s0:c121,c256,c512,c768 tclass=vsock_socket permissive=0 app=
2021-03-31 01:13:23.068 4028-4049/ D/EGL_emulation: eglMakeCurrent: 0x7c8277fb70: ver 3 0 (tinfo 0x7c127a6198) (first time)
2021-03-31 01:13:23.077 4028-4049/ I/Gralloc4: mapper 4.x is not supported
2021-03-31 01:13:23.078 4028-4049/ D/HostConnection: createUnique: call
2021-03-31 01:13:23.078 4028-4049/ D/HostConnection: HostConnection::get() New Host Connection established 0x7c727820d0, tid 4049
2021-03-31 01:13:23.078 4028-4049/ D/goldfish-address-space: allocate: Ask for block of size 0x100
2021-03-31 01:13:23.078 4028-4049/ D/goldfish-address-space: allocate: ioctl allocate returned offset 0x1fd9ac000 size 0x8000
2021-03-31 01:13:23.095 4028-4049/ D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_async_frame_commands ANDROID_EMU_gles_max_version_3_0 
2021-03-31 01:13:26.071 4028-4028/ I/TextInputLayout: EditText added is not a TextInputEditText. Please switch to using that class instead.
2021-03-31 01:13:26.073 4028-4028/ I/TextInputLayout: EditText added is not a TextInputEditText. Please switch to using that class instead.
2021-03-31 01:13:38.025 4028-4028/ W/: Accessing hidden method Ldalvik/system/CloseGuard;->get()Ldalvik/system/CloseGuard; (unsupported,core-platform-api, reflection, allowed)
2021-03-31 01:13:38.025 4028-4028/ W/: Accessing hidden method Ldalvik/system/CloseGuard;->open(Ljava/lang/String;)V (unsupported,core-platform-api, reflection, allowed)
2021-03-31 01:13:38.025 4028-4028/ W/: Accessing hidden method Ldalvik/system/CloseGuard;->warnIfOpen()V (unsupported,core-platform-api, reflection, allowed)
2021-03-31 01:13:38.124 4028-4079/ W/: Accessing hidden method Lcom/android/org/conscrypt/ConscryptEngineSocket;->setUseSessionTickets(Z)V (max-target-q,core-platform-api, reflection, allowed)
2021-03-31 01:13:38.125 4028-4079/ W/: Accessing hidden method Lcom/android/org/conscrypt/ConscryptEngineSocket;->setHostname(Ljava/lang/String;)V (max-target-q,core-platform-api, reflection, allowed)
2021-03-31 01:13:38.125 4028-4079/ W/: Accessing hidden method Lcom/android/org/conscrypt/OpenSSLSocketImpl;->setAlpnProtocols([B)V (max-target-q,core-platform-api, reflection, allowed)
2021-03-31 01:13:38.170 4028-4079/ W/: Accessing hidden method Lcom/android/org/conscrypt/OpenSSLSocketImpl;->getAlpnSelectedProtocol()[B (max-target-q,core-platform-api, reflection, allowed)
2021-03-31 01:13:41.629 4028-4049/ D/OpenGLRenderer: endAllActiveAnimators on 0x7ce27c92d0 (RippleDrawable) with handle 0x7c027b6050
2021-03-31 01:14:48.248 4028-4049/ D/OpenGLRenderer: endAllActiveAnimators on 0x7ce27d0740 (RippleDrawable) with handle 0x7c027dd950

问题诱因与解决方案

经实际排查确认,登录失败并非模拟器本身运行故障导致,实际诱因为两项:

  1. 模拟器登录页的账号输入框存在用户未察觉的残留多行账号内容,提交登录时账号字段叠加了残留文本,与预期输入的账号值不一致,触发服务端校验失败。
  2. 应用内置单设备登录安全策略:同一账号同一时间仅允许单台设备保持有效登录会话。接入实体设备测试时,测试账号已在真机端完成登录并建立有效会话,模拟器端发起的重复登录请求被安全策略拦截,返回登录失败提示。

对应的修复操作:

  • 进入模拟器登录页,对账号输入框执行Cmd+A全选操作,删除所有残留内容后,重新手动输入正确的账号、密码信息再提交登录。
  • 若同一测试账号已在其他设备(真机/其他模拟器)上保持登录状态,先在已登录设备上退出账号会话,再在模拟器端发起登录请求,即可正常通过校验完成登录。

内容的提问来源于stack exchange,提问作者Steven Stricklin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.27 12:24:04