android - 为什么我的项目会在我的手机上运行而不是我的 AVD?

标签 android android-studio

我已经创建了一个项目,它以我需要的方式正常运行。问题是,我需要它在我的手机和我的 AVD 上运行。当我打开我的 AVD(即 Nexus 5X API 28)时,AVD 打开没有问题,但项目将无法运行。以下是我的事件日志中显示的内容。我无法理解这意味着什么,因为我是 android 的新手,但如果有人能告诉我这意味着什么,它会有所帮助吗?谢谢。

14:59   Project setup started
14:59   Gradle sync finished in 6 s 791 ms (from cached state)
14:59   * daemon not running; starting now at tcp:5037
14:59   * daemon started successfully
15:00   Emulator: Warning: Quick Boot / Snapshots not supported on this machine. A CPU with EPT + UG features is currently needed. We will address this in a future release.
15:00   Emulator: dsound: Could not initialize DirectSoundCapture
15:00   Emulator: dsound: Reason: No sound driver is available for use, or the given GUID is not a valid DirectSound device ID
15:00   Emulator: dsound: Attempt to initialize voice without DirectSoundCapture object
15:00   Emulator: dsound: Attempt to initialize voice without DirectSoundCapture object
15:00   Emulator: audio: Failed to create voice `goldfish_audio_in'
15:00   Emulator: C:\Users\PC_User\AppData\Local\Android\Sdk\emulator\qemu\windows-x86_64\qemu-system-x86_64.exe: warning: opening audio input failed
15:00   Emulator: dsound: Attempt to initialize voice without DirectSoundCapture object
15:00   Emulator: dsound: Attempt to initialize voice without DirectSoundCapture object
15:00   Emulator: audio: Failed to create voice `adc'
15:02   Executing tasks: [:app:assembleDebug]
15:03   Gradle build finished in 1 m 35 s 896 ms

最佳答案

以下是一些可能对您有所帮助的提示:

  • 冷启动模拟器并重新安装 apk。
    AVD Manager -> Actions -> Arrow Down: Cold Boot Now -> 删除应用程序 -> 尝试安装并再次运行它(看看 Logcat)
    • 清理并重建您的项目:构建 -> 清理项目 -> 构建 -> 重建项目
    • 使缓存无效并重新启动 IDE:文件 -> 使缓存无效/重新启动

关于android - 为什么我的项目会在我的手机上运行而不是我的 AVD?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54184204/

相关文章:

javascript - Android 4.4 上的 WebView - 使用 JavaScript 更改字体

android - 关闭一个 ViewController 并在 iOS 中启动另一个(不重复,其他答案不起作用)

Android Studio 2.3 无法使用即时运行 : debug apk crash with ClassNotFoundException

Android Studio Bumblebee 不断卡住在 Mac Apple M1 芯片上

java - cookiemanager 中的 setcookie 不适用于 Android

android-studio - Android Studio 未在 Ubuntu 20.04 中启动,因为我从 Andrioid Studio 设置中编辑了 vmoptions

android - 如何在 Android Studio 中添加 'libs' 文件夹?

java - 平板电脑和手机之间的应用程序小部件大小不一致

android - 向 MediatorLiveData 添加多个源并更改其值

java - Android/Java - android 端是否有必要请求 MTU 更新?