Failed to load libGL.so on Android

前端 未结 26 1245
旧巷少年郎
旧巷少年郎 2020-12-04 06:05

I am using Ubuntu 12.04 (Precise Pangolin) with the Oracle JDK 7, and when I am running the Android emulator from Eclipse, it\'s giving this error:

[201         


        
相关标签:
26条回答
  • 2020-12-04 06:54

    What works for me (ubuntu 12.04 64bit) was just to run :

        sudo apt-get install libgl1-mesa-dev
    

    I found that libGL.so exists in directory /usr/lib/x86_64-linux-gnu/

    Installation of 32 bit version was not working.

    0 讨论(0)
  • 2020-12-04 06:54

    I had this problem because I had checked "Use Host GPU" when creating my AVD. I tried it with that option unchecked and I was able to successfully start the emulator. This is acceptable for my testing purposes, but if using the host GPU is important you'll probably want to try some of the other solutions here.

    0 讨论(0)
  • 2020-12-04 06:55

    I am using Ubuntu 12.04 64-bit. Linking /usr/lib64/libGLC.so.0 to /usr/lib64/libGL.so seems to solve the problem.

    EDIT: It stops the error messages, but the emulator is still slow for me.

    0 讨论(0)
  • 2020-12-04 06:56

    On Ubuntu 12.04 64-bit, GNOME 3.4, I first referred to http://developer.android.com/sdk/installing/index.html and installed ia32-lib, which will generate /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2.0

    Then I run the below command and solved this problem:

    sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2.0 /usr/lib/libGL.so
    

    This is slightly different from gridstation's answer.

    I guess there's no need to install the Mesa driver locally, which may cause issues with your real video drivers.

    0 讨论(0)
  • 2020-12-04 06:58

    On Ubuntu 64 bit,

    1. Check libGL,

    $ locate libGL.so
    /usr/lib/i386-linux-gnu/mesa/libGL.so.1
    /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2.0
    /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1
    /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0
    

    2. Create a symlink where the SDK is installed

    ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 /usr/local/android-studio/sdk/tools/lib/libGL.so
    
    0 讨论(0)
  • 2020-12-04 06:58

    To make it work on a Ubuntu 12.10 (Quantal Quetzal) 64-bit, you have to do two things:

    1) You have to initialize LD_LIBRARY_PATH

    Example:

    export LD_LIBRARY_PATH=~/tests/android/adt-bundle-linux-x86_64/sdk/tools/lib
    

    Comments: change the path to your location

    2) You have to create a symbolic link

    a) Use locate libGL to find the correct library:

    rudy@vsolutions:~$ locate libGL
    /home/rudy/opt/android/android-sdk-linux/tools/lib/libGLES_CM_translator.so
    /home/rudy/opt/android/android-sdk-linux/tools/lib/libGLES_V2_translator.so
    /usr/lib/i386-linux-gnu/libGLU.so.1
    /usr/lib/i386-linux-gnu/libGLU.so.1.3.1
    ...
    /usr/lib32/nvidia-current/libGL.so.304.43
    

    b) Create the soft link

    sudo ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0 /usr/lib/libGL.so
    

    Comments: use a 64-bit library on a 64-bit operating system!

    Now start the emulator My system is Optimus, and I have installed Bumblebee. I can use "Intel Open Source Technology Center" "Mesa DRI Intel(R) Ironlake Mobile " "2.1 Mesa 9.0" or "NVIDIA Corporation" "GeForce GT 330M/PCIe/SSE2" "3.3.0 NVIDIA 304.43".

    a) Intel

    /home/rudy/tests/android/adt-bundle-linux-x86_64/sdk//tools/emulator64-arm -avd avd_42 -scale 0.46 -gpu on -verbose
    

    b) Nvidia

    optirun /home/rudy/tests/android/adt-bundle-linux-x86_64/sdk//tools/emulator64-arm -avd avd_42 -scale 0.46 -gpu on -verbose
    

    Comments:

    • I didn't see any difference between the Intel and the Nvidia cards... It is certainly because the emulator is not GPU intensive.
    • On my system an Intel Core i5, it took almost 1 minute to start the emulator... Please be patient... I find the emulator rather fast after it is loaded (the 1 minute to wait). If you start the emulator from the Eclipse IDE, then the emulator does a software emulation (the GPU is off) and took 1 min 30 to start... It is much more slower than using the Intel or Nvidia cards!!!
    • verbose is the parameter to use to display more diagnostics
    • optirun is the command to make use of the Nvidia on Bumblebee. If you don't have Bumblebee don't use it!
    • avd is a virtual device
    • gpu on to make use of the graphical card
    0 讨论(0)
提交回复
热议问题