欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Android模拟器问题记录

程序员文章站 2022-03-05 16:17:36
Android模拟器问题记录Android Studio运行日志错误信息+解决方案无法联网电脑连接VPN模拟器访问不到公司内网启动报错(Emulator: unknown option: -qt-hide-window)启动报错(Emulator: emulator: ERROR: Unknown AVD name [Pixel_2_API_29])下载模拟器时报错(Request failed with status code 416. Status=416, Url=https://dl.google....

Android Studio运行日志

  • Android Studio出现问题后的一般操作步骤就是打开日志文件看详细报错信息,一般都可以根据日志中的信息定位到错误原因,然后针对性解决就可以。
  • 日志文件位置 Android Studio > Help > Show Log in Explorer

错误信息+解决方案

无法联网

  • 设置模拟器DNS
  • .\emulator.exe -avd Pixel_2_API_R -prop net.eth0.dns1=8.8.8.8

电脑连接VPN模拟器访问不到公司内网

  • 切换模拟器WiFi为Android-Wifi

启动报错(Emulator: unknown option: -qt-hide-window)

  • 模拟器版本需要更新
2021-01-12 11:56:47,888 [2047614]   INFO - manager.EmulatorProcessHandler - Emulator: E:\Android\sdk\emulator\emulator.exe -netdelay none -netspeed full -no-snapstorage -avd Pixel_XL_API_30 -qt-hide-window -grpc-use-token -idle-grpc-timeout 300 
2021-01-12 11:56:48,091 [2047817]   INFO - manager.EmulatorProcessHandler - Emulator: unknown option: -qt-hide-window 
2021-01-12 11:56:48,091 [2047817]   INFO - manager.EmulatorProcessHandler - Emulator: please use -help for a list of valid options 
2021-01-12 11:56:48,101 [2047827]   INFO - manager.EmulatorProcessHandler - Emulator: Process finished with exit code 1 
2021-01-12 11:56:48,101 [2047827]   WARN - manager.EmulatorProcessHandler - Emulator terminated with exit code 1 

启动报错(Emulator: emulator: ERROR: Unknown AVD name [Pixel_2_API_29])

  • 新创建的模拟器默认路径为$HOME\.android\avd,可以删除多余的ANDROID_SDK_HOME环境变量或将新创建的模拟器移动到$ANDROID_SDK_HOME\avd下面,删除环境变量可能需要重启电脑才能生效
2021-01-12 12:37:03,468 [4463194]   INFO - manager.EmulatorProcessHandler - Emulator: E:\Android\sdk\emulator\emulator.exe -netdelay none -netspeed full -avd Pixel_2_API_29 -qt-hide-window -grpc-use-token -idle-grpc-timeout 300 
2021-01-12 12:37:03,567 [4463293]   INFO - manager.EmulatorProcessHandler - Emulator: emulator: Android emulator version 30.3.5.0 (build_id 7033400) (CL:N/A) 
2021-01-12 12:37:03,567 [4463293]   INFO - manager.EmulatorProcessHandler - Emulator: emulator: ERROR: Unknown AVD name [Pixel_2_API_29], use -list-avds to see valid list. 
2021-01-12 12:37:03,567 [4463293]   INFO - manager.EmulatorProcessHandler - Emulator: ANDROID_SDK_HOME is defined but there is no file Pixel_2_API_29.ini in $ANDROID_SDK_HOME\avd 
2021-01-12 12:37:03,567 [4463293]   INFO - manager.EmulatorProcessHandler - Emulator: (Note: Directories are searched in the order $ANDROID_AVD_HOME, $ANDROID_SDK_HOME\avd and $HOME\.android\avd) 
2021-01-12 12:37:03,568 [4463294]   INFO - manager.EmulatorProcessHandler - Emulator: Process finished with exit code 1 
2021-01-12 12:37:03,568 [4463294]   WARN - manager.EmulatorProcessHandler - Emulator terminated with exit code 1 
2021-01-12 12:37:16,960 [4476686]   INFO - j.ide.actions.RevealFileAction - Exit code 1 

下载模拟器时报错(Request failed with status code 416. Status=416, Url=https://dl.google.com/android/repository/emulator-windows-7033400.zip)

  • 临时文件异常需要手动删除本地下载缓存然后重新下载E:\Android\sdk\.downloadIntermediates
2021-01-12 11:57:19,813 [2079539]   INFO - ectedPackagesStep$CustomLogger - Packages to install:  
2021-01-12 11:57:19,813 [2079539]   INFO - ectedPackagesStep$CustomLogger - - Intel x86 Emulator Accelerator (HAXM installer) (extras;intel;Hardware_Accelerated_Execution_Manager) 
2021-01-12 11:57:19,813 [2079539]   INFO - ectedPackagesStep$CustomLogger - - Android Emulator (emulator) 
2021-01-12 11:57:19,813 [2079539]   INFO - ectedPackagesStep$CustomLogger - 
 
2021-01-12 11:57:19,813 [2079539]   INFO - ectedPackagesStep$CustomLogger - Preparing "Install Intel x86 Emulator Accelerator (HAXM installer) (revision: 7.5.6)". 
2021-01-12 11:57:19,854 [2079580]   INFO - ectedPackagesStep$CustomLogger - Downloading https://dl.google.com/android/repository/extras/intel/haxm-windows_v7_5_6.zip 
2021-01-12 11:57:24,538 [2084264]   INFO - ectedPackagesStep$CustomLogger - "Install Intel x86 Emulator Accelerator (HAXM installer) (revision: 7.5.6)" ready. 
2021-01-12 11:57:24,538 [2084264]   INFO - ectedPackagesStep$CustomLogger - Preparing "Install Android Emulator (revision: 30.3.5)". 
2021-01-12 11:57:24,539 [2084265]   INFO - ectedPackagesStep$CustomLogger - Downloading https://dl.google.com/android/repository/emulator-windows-7033400.zip 
2021-01-12 11:57:26,173 [2085899]   WARN - ectedPackagesStep$CustomLogger - An error occurred while preparing SDK package Android Emulator: Request failed with status code 416. 
com.intellij.util.io.HttpRequests$HttpStatusException: Request failed with status code 416. Status=416, Url=https://dl.google.com/android/repository/emulator-windows-7033400.zip
	at com.intellij.util.io.HttpRequests.throwHttpStatusError(HttpRequests.java:643)
	at com.intellij.util.io.HttpRequests.openConnection(HttpRequests.java:624)
	at com.intellij.util.io.HttpRequests.access$300(HttpRequests.java:56)
	at com.intellij.util.io.HttpRequests$RequestImpl.getConnection(HttpRequests.java:375)
	at com.android.tools.idea.sdk.StudioDownloader.lambda$doDownloadFully$2(StudioDownloader.java:197)
	at com.intellij.util.io.HttpRequests.doProcess(HttpRequests.java:516)
	at com.intellij.util.io.HttpRequests.process(HttpRequests.java:498)
	at com.intellij.util.io.HttpRequests.access$100(HttpRequests.java:56)
	at com.intellij.util.io.HttpRequests$RequestBuilderImpl.connect(HttpRequests.java:349)
	at com.android.tools.idea.sdk.StudioDownloader.doDownloadFully(StudioDownloader.java:193)
	at com.android.tools.idea.sdk.StudioDownloader.downloadFullyWithCaching(StudioDownloader.java:140)
	at com.android.repository.impl.installer.BasicInstaller.doPrepare(BasicInstaller.java:71)
	at com.android.repository.impl.installer.AbstractPackageOperation.prepare(AbstractPackageOperation.java:337)
	at com.android.tools.idea.sdk.wizard.InstallTask.preparePackages(InstallTask.java:254)
	at com.android.tools.idea.sdk.wizard.InstallTask.run(InstallTask.java:121)
	at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:932)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsync$5(CoreProgressManager.java:434)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$null$3(ProgressRunner.java:233)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:166)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:627)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:572)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:61)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:153)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:233)
	at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1604)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
2021-01-12 11:57:26,175 [2085901]   INFO - ectedPackagesStep$CustomLogger - "Install Android Emulator (revision: 30.3.5)" failed. 

本文地址:https://blog.csdn.net/rrrrrr123rrr/article/details/112555595

相关标签: android 工具