你好,游客 登录 注册 搜索
背景:
阅读新闻

jelly bean(adnroid4.1.1)下emulator不能直接运行的问题

[日期:2012-09-01] 来源:Linux社区  作者:dongminghao888 [字体:大 中 小]

在Android 2.3下只要设置了ANDROID_PRODUCT_OUT环境变量emulator就可以使用了,但是在android 4.1下就不能使用了
只有刚刚make结束的时候的终端可以直接运行,新开一个终端就不行了,出现以下提示:
emulator: ERROR: You did not specify a virtual device name, and the system
directory could not be found.

If you are an Android SDK user, please use '@<name>' or '-avd <name>'
to start a given virtual device (see -help-avd for details).

Otherwise, follow the instructions in -help-disk-images to start the emulator
又不想去装sdk所以就去查代码了
在/externel/qemu/android/main-common.c下发现
AvdInfo* createAVD(AndroidOptions* opts, int* inAndroidBuild)函数
 809             android_build_root = getenv("ANDROID_BUILD_TOP");
 810             if (android_build_root == NULL || android_build_root[0] == 0)
 811                 break;

在上面两行中,如果android_build_root为0就直接跳出循环了
但是android_build_out = out;
在这之后
所以,829行 if (opts->avd == NULL && !android_build_out)
就都为真了
不知道是不是bug。
其实,可以将android_build_out = out;提到前面来
这样判断就不会进入,如果是非要大家设置ANDROID_BUILD_TOP环境变量
那也应该先执行以下
 813             if (!path_exists(android_build_root)) {
 814                 derror("Can't find the Android build root '%s'\n"
 815                     "Please check the definition of the ANDROID_BUILD_TOP variable.\n"
 816                     "It should point to the root of your source tree.\n",
 817                     android_build_root );
 818                 exit(2);
 819             }
再跳出循环

目前的解决方式是设置ANDROID_BUILD_TOP环境变量

linux
相关资讯       Android开发入门 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款