【问题标题】:Error while creating android AVD: (Permission denied) inside Ubuntu创建 android AVD 时出错:(权限被拒绝)在 Ubuntu 中
【发布时间】:2014-02-04 19:35:40
【问题描述】:

我是 IOS 和 Android 应用程序编程的初学者。

我在 Ubuntu 中有带有 Android SDKAVDEclipse

当我从终端启动 android 时。这个电话Android SDK Manager

我打开这个问题是因为问题出在我创建设备 AVD 时。 我安装了两个版本的 Android:

user@user-F50Sf:~/Downloads$ android list targets
Available Android targets:
----------
id: 1 or "android-18"
     Name: Android 4.3
     Type: Platform
     API level: 18
     Revision: 2
     Skins: WXGA800, WXGA800-7in, WSVGA, WQVGA400, HVGA, WXGA720, WVGA800 (default), QVGA, WQVGA432, WVGA854
     ABIs : no ABIs.
----------
id: 2 or "android-19"
     Name: Android 4.4.2
     Type: Platform
     API level: 19
     Revision: 2
     Skins: WXGA800, WXGA800-7in, WSVGA, WQVGA400, HVGA, WXGA720, WVGA800 (default), QVGA, WQVGA432, WVGA854
     ABIs : armeabi-v7a
user@user-F50Sf:~/Downloads$  

现在我想从终端创建新设备,我有这个错误:

 user@user-F50Sf:~/Downloads$ android create avd -n mySim -t android-19
    Auto-selecting single ABI armeabi-v7a
    Android 4.4.2 is a basic Android platform.
    Do you wish to create a custom hardware profile [no]
    Error: /home/user/.android/avd/mySim.ini (Permission denied)

当我创建新设备 AVD 时,我也总是在 Eclipse 中出现这个错误

我在更新后尝试在/etc/profile 中添加Phonepag 的路径。 但是终端仍然出现错误

/etc/profile

# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "$PS1" ]; then
  if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
    # The file bash.bashrc already sets the default PS1.
    # PS1='\h:\w\$ '
    if [ -f /etc/bash.bashrc ]; then
      . /etc/bash.bashrc
    fi
  else
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '
    else
      PS1='$ '
    fi
  fi
fi

# The default umask is now handled by pam_umask.
# See pam_umask(8) and /etc/login.defs.

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if [ -r $i ]; then
      . $i
    fi
  done
  unset i
fi
export PATH=${PATH}:/opt/android-sdk-linux/tools
export PATH=${PATH}:/opt/android-sdk-linux/platform-tools
export PATH=${PATH}:/usr/lib/node_modules/phonegap/bin

我哪里错了???

编辑: 使用 sudo 我有 command not found

sudo android create avd -n mySim -t android-19
[sudo] password for user: 
sudo: android: command not found

【问题讨论】:

  • 当你以 sudo 运行它时会发生什么(不确定它写入哪些目录)
  • ´sudo android create avd -n mySim -t android-19 [sudo] 用户密码:sudo: android: command not found´
  • android 不在系统路径中。您需要进入找到文件 android 的目录,然后重复命令 bbut 使用 ./android 而不是 android。 sudo android create avd -n mySim -t android-19 如果可行,那么这是一个权限问题,您可以递归地更改该文件夹的权限。须藤 chmod 777 文件夹 -r
  • 现在功能使用 sudo -s chmod -R 777 /home/user/.android/
  • 为什么在我创建 AVD user@user-F50Sf:~$ emulator -avd mySim NAND: could not write file /home/user/.android/avd/mySim.avd 之后出现这个错误/userdata-qemu.img, 没有那个文件或目录

标签: android eclipse ubuntu avd android-sdk-tools


【解决方案1】:

AVD 管理器无法访问 .android 文件夹。 不确定它是否是正确的解决方案,但更改文件夹的权限对我有用:

sudo chmod 777 -R /home/user/.android

这里的“用户”是执行 AVD 管理器的用户,很可能是您的用户。

【讨论】:

  • 补充一点,有几个地方我的权限被关闭了。首先,我在 Ubuntu 中安装了 android-tools-adb 包并且必须以 root 身份运行它,所以当它在我的主目录 (~/.android) 中创建 .android 目录时,它以 root 身份创建它。其次,当我为 android studio 做./configure; make; make install 时,我也使用了sudo,所以我也不得不更改那些导演权限(虽然我不相信这很重要——我只是不愿意回去并在不更改它们的情况下进行测试。)
猜你喜欢
  • 2013-05-25
  • 2016-01-17
  • 1970-01-01
  • 2017-02-02
  • 2019-06-05
  • 2022-01-19
  • 1970-01-01
  • 2022-06-24
  • 1970-01-01
相关资源
最近更新 更多