2012-12-05 56 views
30

的地圖V2文檔狀態:Android地圖API需要OpenGL ES 2.0

由於谷歌地圖的Android API的版本2需要OpenGL ES 版本2,必須添加一個<uses-feature>元素的子在 manifest元素在AndroidManifest.xml:

<uses-feature 
    android:glEsVersion="0x00020000" 
    android:required="true"/>` 

該通知的要求 外部服務。特別是,它具有防止谷歌 Play商店從裝置上顯示的應用程序不支持 OpenGL ES版本2

其實效果,它拋出一個exception如果這不是在清單。我不想在商店中過濾我的應用程序,我打算繼續使用舊設備的舊地圖,並且只在需要的功能出現時才顯示新地圖,並且在運行時檢測,而不是在安裝之前檢測到。

那麼我該怎麼做?它是否必須是多個APKs與不同manifests

+2

Just android:required =「false」。那麼它不應該被過濾。 – thaussma

+6

'android:required =「false」'result in'12-05 22:18:31.484:E/AndroidRuntime(9618):引發:java.lang.RuntimeException:Google Maps Android API僅支持OpenGL ES 2.0及更高版本。在Nexus S上添加到AndroidManifest.xml中 '4.1.2 – qubz

+0

同樣的問題在這裏,如果我從清單(或set required =「false」),MapFragment會在支持OpenGL ES 2.0的設備上引發異常。就好像MapFragment正在尋找活動服務配置中的需求,而不是檢查設備本身是否支持OpenGL ES 2.0。 –

回答

28

最後更新

隨着2013年12月20日時,Android Dashboard顯示,設備約100%,現在支持OpenGL 2.0及以上版本所以這個答案已經不再重要。您可能只需要清單中的OpenGL ES 2.0+。

這被固定爲谷歌的轉7的更新Play服務SDK插件。使用<uses-feature android:glEsVersion="0x00020000" android:required="false"/>detect OpenGL ES 2.0 at runtime是安全的。

原來的答覆

看來,谷歌地圖的Android API V2需要顯式聲明<uses-feature android:glEsVersion="0x00020000" android:required="true/>AndroidManifest.xml所以沒有辦法,不排除所有的OpenGL ES 1.x的設備上部署谷歌地圖API的Android V2服務。在撰寫本文時,Google's Android Dashboard表明,在1.1和2.0設備中,90.8%的設備支持2.0。

在一個特定的設備(摩托羅拉XOOM),該代碼產生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; 

然而,當不存在<uses-feature>聲明在清單,MapFragment是投擲一個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 

以下是希望更新地圖庫可以消除此限制,以便我們可以部署單個APK並使用運行時API確定是否加載新版Google地圖v2體驗或回退到其他版本ible解決方案。

+4

此問題已在此處進行跟蹤:http://code.google.com/p/gmaps-api-issues/issues/detail?id=4699 不要忘記明星問題,希望它會得到注意到。截至2012年12月,只有7票。 –

1

提到我有同樣的問題,環顧四周,大部分用於仿真器的建議的解決方法並沒有爲我工作將與地圖API的Android下一版發佈。然後我發現一個帖子是Genymotion模擬器被建議。該仿真器支持OpenGL ES版本2.它也比標準仿真器快得多。