Android Maps API requires openGL es 2

后端 未结 3 1143
野性不改
野性不改 2020-12-02 17:20

The Maps v2 documentation states:

Because version 2 of the Google Maps Android API requires OpenGL ES version 2, you must add a

相关标签:
3条回答
  • 2020-12-02 17:34

    I had the same problem, looked around and most of the suggested workaround for the emulator didn't work for me. Then i found a post were the Genymotion emulator was suggested. This emulator supports OpenGL ES version 2. It is also much faster than the standard emulator.

    0 讨论(0)
  • 2020-12-02 17:47

    This is fixed and will be release with next release of Maps Android API as mentioned in issue #4699

    0 讨论(0)
  • 2020-12-02 17:57

    Final Update

    As of 2013/12/20, the Android Dashboard shows that approximately 100% of devices now support OpenGL 2.0+ so this answer is no longer relevant. You may simply require OpenGL ES 2.0+ in your manifest.

    Update

    This is fixed as of rev 7 of the Google Play Services SDK add-on. It is safe to use <uses-feature android:glEsVersion="0x00020000" android:required="false"/> and to detect OpenGL ES 2.0 at runtime.

    Original answer

    It appears that the Google Maps Android API v2 requires an explicit <uses-feature android:glEsVersion="0x00020000" android:required="true/> declaration in AndroidManifest.xml so there is no way to deploy Google Maps Android API v2 services without excluding all OpenGL ES 1.x devices. At the time of this writing, Google's Android Dashboard shows that, among 1.1 and 2.0 devices, 90.8% of devices support 2.0.

    On a particular device (Motorola XOOM), this code results in supportsEs2 = true:

    // Check if the system supports OpenGL ES 2.0.
    final ActivityManager activityManager = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
    final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
    final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;
    

    However, when there is no <uses-feature> declaration in the manifest, MapFragment is throwing a RuntimeException:

        Caused by: java.lang.RuntimeException: Google Maps Android API only supports OpenGL ES 2.0 andabove. Please add <uses-feature android:glEsVersion="0x00020000" android:required="true" /> into AndroidManifest.xml
        at maps.y.ae.a(Unknown Source)
        at maps.y.bu.a(Unknown Source)
        at maps.y.p.onCreateView(Unknown Source)
        at com.google.android.gms.maps.internal.IMapFragmentDelegate$Stub.onTransact(IMapFragmentDelegate.java:107)
        at android.os.Binder.transact(Binder.java:297)
        at com.google.android.gms.maps.internal.IMapFragmentDelegate$a$a.onCreateView(Unknown Source)
        at com.google.android.gms.maps.SupportMapFragment$a.onCreateView(Unknown Source)
        at com.google.android.gms.internal.c$4.a(Unknown Source)
        at com.google.android.gms.internal.c.a(Unknown Source)
        at com.google.android.gms.internal.c.onCreateView(Unknown Source)
        at com.google.android.gms.maps.SupportMapFragment.onCreateView(Unknown Source)
        at android.support.v4.app.Fragment.performCreateView(Fragment.java:1460)
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:884)
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1066)
        at android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1168)
        at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:280)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:669)
        ... 22 more
    

    Here's to hoping that an update to the Maps library will remove this limitation so we can deploy a single APK and use runtime APIs to determine whether or not to load the new Google Maps v2 experience or fall back to another compatible solution.

    0 讨论(0)
提交回复
热议问题