Android Studio AVD error launching

后端 未结 7 1092
感动是毒
感动是毒 2020-12-08 20:57

I have a Nexus 6P API23 emulator downloaded on my Ubuntu 15.10 PC. When I try to launch it, it fails and a dialog box pops up and says:

(AVD config: Nexus 6P API 23

7条回答
  •  天命终不由人
    2020-12-08 21:23

    I've had the same error as you and have managed to find a workaround. Hopefully this will solve your issue as well.

    Rather than launching the emulator from Android Studio, open the terminal and cd into the tools directory withing your Android SDK directory - mine is ~/Android/Sdk/tools. From there run the command:

    LD_PRELOAD='/usr/$LIB/libstdc++.so.6' DISPLAY=:0 ./emulator -avd

    You should now be able to launch your application with android studio by pressing the green run arrow and selecting the emulator you just started.

    For more information as to why this works go here

    Edit:

    After some more thought, I tried this script and it seems to work, so that you can start the emulator within the Android Studio. It replaces emulator executable with a bash script that calls it as above. You'll need to change to tools path to the correct location. I'd also suggest making a backup copy of your tools directory in case something goes wrong:

    #!/bin/bash
    
    TOOLS_PATH='/home/user/Android/Sdk/tools'
    UNEXPANDED_LIB='$LIB'
    
    for emul in ${TOOLS_PATH}/em*
    do
    cp ${emul} ${emul}-orig
    cat < ${emul}
    #!/bin/bash
    LD_PRELOAD='/usr/$UNEXPANDED_LIB/libstdc++.so.6' ${emul}-orig "\$@"
    EOF
    done
    

提交回复
热议问题