android studio 模拟器 avd 点击启动无反应问题
Tofloor
poster avatar
oliverchu
deepin
2017-03-12 08:55
Author
我是通过官方网站下的android studio 2.3  for Linux ,解压到/opt/android-studio 目录下,启动studio.sh之后,安装好了sdk 和 virtual device ,成功跑了一个工程,也成功启动了模拟器;
但是,悲剧的事情第二天发生了,现在点击运行app按钮,启动模拟器过程中,并没有启动成功,没有任何提示。通过google 相关问题,去了sdk目录下的emulator中去执行 emulator命令手动启动模拟器,但是执行 过程中提示没有找到该命令。

这个问题我室友也与到了,都是启动成功一次后,第二次就不能启动。我在想是不是因为没有权限执行启动命令?但是没有任何提示和报错,这个 问题真的很棘手!

麻烦论坛中的大神告知下,我是打算一直用deepin os 做开发的了。


Reply Favorite View the author
All Replies
avatar
DebuggerX
deepin
2017-03-12 15:52
#1
1.用终端去执行命令就会看到错误信息
Reply View the author
avatar
DebuggerX
deepin
2017-03-12 15:58
#2
debuggerx 发表于 2017-3-12 07:52
1.用终端去执行命令就会看到错误信息

2.深度商店里的as很好用,我用这个做安卓开发快一年了。as在某种程度上也算是版本帝了,但是几乎每次大更新都会有点坑,所以生产环境建议尽量保持在稳定的版本,不建议自己安装……
Reply View the author
avatar
攻城狮
deepin
2017-04-22 22:12
#3
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request:  GLXBadContext
  Major opcode of failed request:  154 (GLX)
  Minor opcode of failed request:  6 (X_GLXIsDirect)
  Serial number of failed request:  49
  Current serial number in output stream:  48
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request:  GLXBadContext
  Major opcode of failed request:  154 (GLX)
  Minor opcode of failed request:  6 (X_GLXIsDirect)
  Serial number of failed request:  49
  Current serial number in output stream:  48
emulator: WARNING: encryption is off
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  154 (GLX)
  Minor opcode of failed request:  24 (X_GLXCreateNewContext)
  Value in failed request:  0x0
  Serial number of failed request:  33
  Current serial number in output stream:  34
QObject::~QObject: Timers cannot be stopped from another thread
段错误



我也遇到,这是错误提示
Reply View the author
avatar
攻城狮
deepin
2017-04-23 02:03
#4
https://bbs.deepin.org/post/138244#
Reply View the author
avatar
DebuggerX
deepin
2017-04-23 02:42
#5
bingeneral 发表于 2017-4-22 14:12
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: fai ...

加载不到各种so,我貌似也碰到过,其实就是环境变量不对,试着添加一下就行了。。尤其是官网下载直接运行sh的那种,环境变量的设置只对那次开机有效,重启运行图标就出问题了
Reply View the author
avatar
oliverchu
deepin
2017-05-06 08:58
#6
https://bbs.deepin.org/post/135936
https://bbs.deepin.org/post/138244#

你好 其实我找到了更方便的解决办法,使用qt写了一个窗体程序方便打开
  1. #include "androidemulatordialog.h"
  2. #include "ui_androidemulatordialog.h"
  3. #include "stdlib.h"
  4. #include
  5. #include "iostream"
  6. #include
  7. #include
  8. #include


  9. AndroidEmulatorDialog::AndroidEmulatorDialog(QWidget *parent) :
  10.     QDialog(parent),
  11.     ui(new Ui::AndroidEmulatorDialog)
  12. {
  13.     ui->setupUi(this);
  14.     FILE *fp;
  15.       int status;
  16.       char path[1035];
  17.       fp = popen("ls ~/.android/avd | grep .avd", "r");
  18.       if (fp == NULL) {
  19.         std::cout<<"failed to read cmd"<
  20.         exit;
  21.       }
  22.       QStringListModel *model;
  23.       QStringList emulatorList;
  24.       while (fgets(path, sizeof(path)-1, fp) != NULL) {
  25.         emulatorList.push_back(path);
  26.       }
  27.       pclose(fp);
  28.       model = new QStringListModel(this);
  29.       model->setStringList(emulatorList);
  30.       ui->lvEmulators->setModel(model);
  31.       ui->lvEmulators->setEditTriggers(QAbstractItemView::NoEditTriggers);

  32. }

  33. AndroidEmulatorDialog::~AndroidEmulatorDialog()
  34. {
  35.     delete ui;
  36. }

  37. void AndroidEmulatorDialog::on_buttonBox_accepted()
  38. {
  39.     int idx =ui->lvEmulators->currentIndex().row();
  40.     QString str = ui->lvEmulators->model()->index(idx, 0).data().toString();
  41.     QString cmd;
  42.     cmd.append("nohup ~/Android/Sdk/tools/emulator -use-system-libs -avd ").append(str.left(str.indexOf("."))).append(" &");
  43.     QByteArray ba = cmd.toLatin1();
  44.     char *mm = ba.data();

  45.     system(mm);
  46.     accept();

  47. }
Copy the Code


核心执行的就是
  1. nohup ~/Android/Sdk/tools/emulator -use-system-libs -avd AVD名称
Copy the Code

Reply View the author
avatar
cosecant
deepin
2017-05-06 16:38
#7


    如何处理Linux不能启用AVD的问题?

    First, install some packages and libs:
    $ sudo apt-get install lib64stdc++6:i386
    $ sudo apt-get install mesa-utils

    Second, tweak some links:
    $ cd YOURPATH/Android/Sdk/emulator/lib64
    $ mv libstdc++/ libstdc++.bak
    $ ln -s /usr/lib64/libstdc++.so.6 libstdc++
    Third, relaunch your AVD device and test it.
Reply View the author
Comments
bovenson
2017-08-21 21:14
OK
avatar
FWHeart
deepin
2017-06-12 22:14
#8
https://bbs.deepin.org/post/135936
如何处理Linux不能启用AVD的问题?

    First, install some packages and libs:

十分感谢成功的解决了我的问题

你是在哪看到这个的啊
Reply View the author
avatar
cosecant
deepin
2017-06-13 00:09
#9
https://bbs.deepin.org/post/135936
十分感谢成功的解决了我的问题

你是在哪看到这个的啊

应该是谷歌上找到的
Reply View the author
avatar
oliverchu
deepin
2017-11-23 18:54
#10
我是这样的:  通过启动avd的时候制定使用系统的library, 这样我写了个 python脚本

  1. import os

  2. AVD_HOME =  os.environ['HOME']+"/.android/avd"
  3. ANDROID_HOME = os.getenv("ANDROID_HOME")
  4. EMULATOR_CMD = "nohup "+ANDROID_HOME+"/tools/emulator -use-system-libs -avd "
  5. avds = []

  6. def run():
  7.    
  8.     i = 1
  9.     print "Please select a avd to start up :"
  10.     for fname in os.listdir(AVD_HOME):
  11.         fstr = str(fname)
  12.         if fstr.endswith(".ini"):
  13.             fstr = fstr.replace(".ini","")
  14.             print i,".....",fstr
  15.             avds.append(fstr)
  16.             i+=1
  17.     process()

  18. def process():
  19.     inval = raw_input(">")
  20.     if inval.isdigit():
  21.         inval = int(inval)
  22.         if inval <= avds.__len__() and inval > 0:
  23.             os.system(EMULATOR_CMD+avds[inval-1]+" >/dev/null 2>&1 &")
  24.             exit(0)
  25.         else:
  26.             print "Please input agian."
  27.             process()
  28.     else:
  29.         print "Please input agian."
  30.         process()

  31. if __name__ == "__main__" :
  32.     try:
  33.         run()
  34.     except KeyboardInterrupt:
  35.         print "\nBye.See you next time."
  36.         exit(0)
Copy the Code


运行它,会让你选择启动哪一个模拟系统

Reply View the author
avatar
shamine
deepin
2017-11-23 19:09
#11
你们在用kotlin了么,我们新版本都开始转kotlin了 话说确实好用
Reply View the author