7

我按照下面的链接创建了一个 android 虚拟设备(AVD)。

https://developer.android.com/studio/run/managing-avds.html

一旦我单击完成按钮,它就会给我以下错误:

创建 AVD 时出错。有关详细信息,请参阅idea.log。正如我所看到的,最后一行给出了拒绝访问错误。它是否需要 .android 文件夹的权限?当我尝试授予 .android 文件夹权限时,它不允许我。它说

chmod:无法访问“777”:没有这样的文件或目录

idea.log 文件的最后几行是

想法.log

2018-01-11 13:00:17,173 [d thread 4]   INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 86ms; general responsiveness: ok; EDT responsiveness: ok 
2018-01-11 13:00:18,629 [d thread 1]   INFO - .script.IdeScriptEngineManager - javax.script.ScriptEngineManager initialized in 72 ms 
2018-01-11 13:00:19,672 [se-915-b01]   INFO - pl.ProjectRootManagerComponent - project roots have changed 
2018-01-11 13:00:19,706 [d thread 2]   INFO - .diagnostic.PerformanceWatcher - Pushing properties took 2ms; general responsiveness: ok; EDT responsiveness: ok 
2018-01-11 13:00:19,766 [d thread 2]   INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 60ms; general responsiveness: ok; EDT responsiveness: ok 
2018-01-11 13:00:22,373 [d thread 3]   INFO - tools.idea.ddms.adb.AdbService - Initializing adb using: /home/shivam/Android/Sdk/platform-tools/adb, client support = false 
2018-01-11 13:00:22,466 [err reader]   WARN -            #com.android.ddmlib - * daemon not running; starting now at tcp:5037 
2018-01-11 13:00:26,005 [err reader]   WARN -            #com.android.ddmlib - * daemon started successfully 
2018-01-11 13:00:26,220 [d thread 3]   INFO - tools.idea.ddms.adb.AdbService - Successfully connected to adb 
2018-01-11 13:00:46,918 [se-915-b01]   WARN - vdmanager.AvdManagerConnection - java.nio.file.AccessDeniedException: /home/shivam/.android/avd/Nexus_5X_API_23.ini 
2018-01-11 13:01:04,305 [d thread 1]   INFO - tools.idea.ddms.adb.AdbService - Initializing adb using: /home/shivam/Android/Sdk/platform-tools/adb, client support = true 
2018-01-11 13:01:04,323 [err reader]   WARN -            #com.android.ddmlib - * daemon not running; starting now at tcp:5037 
2018-01-11 13:01:07,454 [err reader]   WARN -            #com.android.ddmlib - * daemon started successfully 
2018-01-11 13:01:07,656 [d thread 1]   INFO - tools.idea.ddms.adb.AdbService - Successfully connected to adb 
2018-01-11 13:01:54,534 [se-915-b01]   WARN - vdmanager.AvdManagerConnection - java.nio.file.AccessDeniedException: /home/shivam/.android/avd/Nexus_5X_API_23.ini 
4

3 回答 3

19

好的,我让它工作了,您需要为隐藏的 .android 文件夹授予 777 权限。在终端中运行以下命令,其中隐藏文件夹。您需要使用 -R 标志,它将递归到每个子目录。

例如,运行sudo chown -R my_username:my_username .android将生成 .android 以及您拥有的所有子目录。

于 2018-01-11T11:54:13.617 回答
5

对于 Mac,本教程用于确保我的 root 管理员级别可以通过在终端中运行此行来访问此文件

sudo chown -Rv *UserFolderName /Users/*UserFolderName/.android

对于上面的 *UserFolderName 应该更改将使用 Android Studio 的用户(很可能是你)

于 2018-09-25T03:01:13.463 回答
2

Android Studio 正在尝试将文件写入 /home/shivam/.android/avd 文件夹,但存在某种形式的权限问题。

检查 /home/shivam/.android 文件夹的权限。出于某种原因,在安装时,Android Studio 仅使用 root 访问权限创建此文件夹,但随后无法创建 avd 文件夹并写出虚拟设备文件。

修复是给自己root访问权限并将/home/shivam/.android文件夹的所有者更改为您的用户名。

于 2018-01-11T08:13:41.357 回答