当我安装了 Google Play 服务时,我的应用程序可以正常工作,但没有它,当我打开它时应用程序会停止。很清楚,但是当我添加检查 Google Play 服务是否在设备上可用以及何时不可用的方法时,它应该显示错误对话框,但是它。应用程序也不打开。
这是我从其他帖子中复制的代码。我尝试通过我的代码执行此操作,但它也不起作用。
方法:
public void checkGooglePlayServicesAvailability()
{
int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
if(resultCode != ConnectionResult.SUCCESS)
{
Dialog dialog = GooglePlayServicesUtil.getErrorDialog(resultCode, this, 1);
dialog.setCancelable(false);
dialog.show();
}
Log.d("GooglePlayServicesUtil Check", "Result is: " + resultCode);
}
调用 onResume():
@Override
protected void onResume()
{
checkGooglePlayServicesAvailability();
super.onResume();
}
我也安装了谷歌地图。也许有人可以帮助我?
编辑:LogCat:
07-07 15:33:39.150: E/Trace(3448): error opening trace file: No such file or directory (2)
07-07 15:33:41.361: E/Google Maps Android API(3448): Google Maps Android API v2 only supports devices with OpenGL ES 2.0 and above
07-07 15:43:15.820: E/Google Maps Android API(3524): Google Maps Android API v2 only supports devices with OpenGL ES 2.0 and above
07-07 16:06:55.349: E/Trace(3615): error opening trace file: No such file or directory (2)
07-07 16:06:57.841: E/Google Maps Android API(3615): Google Maps Android API v2 only supports devices with OpenGL ES 2.0 and above