Apparently variables such as ANDROID_PRODUCT_OUT should be automatically created during a build and using the envSetup.sh script. I guess something has gone wrong with my environment setup for this not to happen.
I ALSO ATTEMPTED to get this to work and LEARNED that:
lunch full-eng sets up all the appropriate env
to check it, simply run: env | grep ANDROID and you will see all the appropriate env variables setup. These are local to the current shell only!
emulator then does what it should.
When I came back to the shell later, I simply ran lunch full-eng again to restore my environment. I hope this helps others as well!
To check my built sources for emulator I've created the following script in the root folder of the project. I run it from another command line and it does not require to run all the time running . build/envsetup.sh and lunch full-eng commands. You can edit this script for your needs and if you need to run other device - simply change folder.
In fact, the program "emulator" is just a wrapper for the real emulator-qemu, such as emulator-arm or emulator-x86. The "emulator" you invoked will collect the arguments you typed in and find the proper emulator-qemu to execute.
The problem you met is that you did not explicitly describe which image/avd you want to start. You can either using the argument "@avd YOUR-AVD_NAME" or "ANDROID_PRODUCT_OUT" environment variable to set the dir where your avd is placed. BTW, avd dir contains some files to describe how this device looks like.
". build/envsetup.sh" is the script that set the environment variables for the Android build process. So it is easy to understand why "ANDROID_PRODUCT_OUT" will be set at that time. Its default value should be "PATH/TO/ANDROID/out/target/product/generic".
PS: If you want to know more, you can refer to the source file: "PATH/TO/ANDROID/external/qemu/android/main-emulator.c". You can find the emulator main there.
发布评论
评论(5)
您分享了:
我也尝试让它工作并了解到:
lunch full-eng 设置所有适当的环境
环境| grep ANDROID
您将看到所有适当的环境变量设置。
这些仅适用于当前 shell!
当我稍后回到 shell 时,我只是再次运行午餐 full-eng 来恢复我的环境。
我希望这也对其他人有帮助!
You shared that:
I ALSO ATTEMPTED to get this to work and LEARNED that:
lunch full-eng
sets up all the appropriate envenv | grep ANDROID
and you will see all the appropriate env variables setup.
These are local to the current shell only!
emulator
then does what it should.When I came back to the shell later, I simply ran lunch full-eng again to restore my environment.
I hope this helps others as well!
只需执行以下操作:
就可以了。确保从源目录运行它。
Just do the following:
That does the trick. Make sure you run it from your source directory.
为了检查我为模拟器构建的源,我在项目的根文件夹中创建了以下脚本。我从另一个命令行运行它,它不需要一直运行
。 build/envsetup.sh
和lunch full-eng 命令。您可以根据需要编辑此脚本,如果您需要运行其他设备 - 只需更改文件夹即可。
To check my built sources for emulator I've created the following script in the root folder of the project. I run it from another command line and it does not require to run all the time running
. build/envsetup.sh
andlunch full-eng
commands. You can edit this script for your needs and if you need to run other device - simply change folder.您可以将这些添加到您的 .bashrc 文件中
You can add these to your .bashrc file
事实上,“emulator”程序只是真正的emulator-qemu的包装,例如emulator-arm或emulator-x86。您调用的“模拟器”将收集您输入的参数并找到要执行的正确模拟器-qemu。
您遇到的问题是您没有明确描述要启动哪个图像/avd。您可以使用参数“@avd YOUR-AVD_NAME”或“ANDROID_PRODUCT_OUT”环境变量来设置放置avd的目录。顺便说一句,avd dir 包含一些文件来描述该设备的外观。
“.build/envsetup.sh”是为Android构建过程设置环境变量的脚本。所以就很容易理解为什么当时会设置“ANDROID_PRODUCT_OUT”了。它的默认值应该是“PATH/TO/ANDROID/out/target/product/generic”。
PS:如果想了解更多,可以参考源文件:“PATH/TO/ANDROID/external/qemu/android/main-emulator.c”。您可以在那里找到模拟器主程序。
In fact, the program "emulator" is just a wrapper for the real emulator-qemu, such as emulator-arm or emulator-x86. The "emulator" you invoked will collect the arguments you typed in and find the proper emulator-qemu to execute.
The problem you met is that you did not explicitly describe which image/avd you want to start. You can either using the argument "@avd YOUR-AVD_NAME" or "ANDROID_PRODUCT_OUT" environment variable to set the dir where your avd is placed. BTW, avd dir contains some files to describe how this device looks like.
". build/envsetup.sh" is the script that set the environment variables for the Android build process. So it is easy to understand why "ANDROID_PRODUCT_OUT" will be set at that time. Its default value should be "PATH/TO/ANDROID/out/target/product/generic".
PS: If you want to know more, you can refer to the source file: "PATH/TO/ANDROID/external/qemu/android/main-emulator.c". You can find the emulator main there.